A few more things I learned to increase the security of your php pages.
Php is processed on the server before anything is sent to the browser. Because of this, no php is sent to the browser, only the html output produced by the script.
So don't leave off your opening and closing php tags, and your code is safe from surfers.
Also, a good idea is to put your connect info in a connect.inc file and include it at the beginning, so that if the php server does fail and people can look at your code in raw form then they can't see your info.
Add this to your index and admin pages (just the main pages)
| Quote: |
$queryString = strtolower($_SERVER['QUERY_STRING']);
if (strstr($queryString,'%20union%20') OR strstr($queryString,'/*')) {
header("Location: index.php");
die();
} |
Add this to your included files:
| Quote: |
if (eregi("THISFILENAME.inc", $_SERVER['SCRIPT_NAME'])) {
Header("Location: ../relative/path/to/index.php");
die();
} |
_________________
Dust fills my eyes / Clouds roll by / and I roll with them / Centuries cry / Orders fly / and I fall again
Afford best design, implement best solution. Outsource your web design.