DeluXe Network Forums
March 18, 2010, 12:39:18 pm *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Please do not add ads in your signature!
 
   Home   Help Search Members Login Register  
Pages: [1]
  Print  
Author Topic: avoid php pages getting hacked  (Read 773 times)
susapra
Newbie
*

Honor: 0
Offline Offline

Sri Lanka Sri Lanka

Posts: 3


View Profile
« on: October 26, 2008, 06:15:58 am »

hi every body

does any body have any idea on how to hack php pages or how to prevent hacking of php pages Smiley

thanks in advance
Logged
Endrju
Global Moderator
Hero Member
*****

Honor: 4
Offline Offline

Poland Poland

Posts: 2466



View Profile WWW
« Reply #1 on: December 06, 2008, 01:38:14 pm »

Well this is not h4x0r board. :-P

http://www.google.pl/search?q=how+to+write+secure+php+code
Logged

Straight Edge till death.
moraxiforfax
Newbie
*

Honor: 0
Offline Offline

United States United States

Posts: 3


View Profile
« Reply #2 on: April 06, 2009, 01:24:38 pm »

Writing Secure PHP

http://www.addedbytes.com/php/writing-secure-php/
Logged

Rule Number One: Never, Ever, Trust Your Users.
Rule Number Two: Be Completely and Utterly Paranoid.
lioncross070
Newbie
*

Honor: 0
Offline Offline

China China

Posts: 1


View Profile
« Reply #3 on: April 11, 2009, 04:13:47 pm »

Hey there,

First of all... any good "hacker" is not going to to just flat out tell you how to hack something. Believe it or not, hackers usually follow a set of rules or "hacker ethics," which strongly discourages this practice.

I can, however, give you some of the best tips for writing secure PHP scripts.



Here are some of the most important:

1) Always turn off error reporting on production (working) sites/scripts. While error reporting is your friend when you're developing, the information it shows can be incredibly useful for a hacker. At the top of each page put:

Code:
<?php
ini_set
('error_reporting'0)
?>

2) Never turn on "register_globals()." This function allows variables to be used that you haven't explicitly declared. While it speeds up development time, it's also incredibly dangerous. Most hosting companies will have it off by default, and it's not even be an option in PHP 6, but it's always good to double check by doing:

Code:
<?php
ini_set
('register_globals''Off')
?>

3) NEVER TRUST YOUR USERS. Every single piece of data you allow users to submit/modify on your site poses a huge risk, especially if this data will be stored on a database. Validate and sanitize ALL input with extreme prejudice. The more paranoid you are, the better. Some useful functions are:

Code:
<?php

//Perform a "magic quotes" style escaping(\) of (' and ") characters
mysql_real_escape_string($variable)

//Check the variable or string against a regular expression - VERY userful
preg_match("/expression/"$variable)

//Make sure the variable or string is under a certain length
if (strlen($first_name) > 20) {
     die(
"Nobody's first name is that long!");
}

//Strip HTML and PHP tags
strip_tags($variable)

?>

There's a ton more out there to learn, these are just some of the very basics. Here are a few really good links to learn more about writing secure PHP.


http://www.addedbytes.com/php/writing-secure-php/

http://us2.php.net/manual/en/security.php

http://www.ibm.com/developerworks/op...pps/index.html
Logged
Pages: [1]
  Print  
 
Jump to:  

 

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 0.51 seconds with 18 queries.