Article:
 |
|
Ten Security Checks for PHP, Part 1
|
| Subject: |
|
Nicer code |
| Date: |
|
2003-03-24 13:42:28 |
| From: |
|
anonymous2
|
|
|
Hi guys,
I find this code better than yours:
$valid_pages = array ('apage.php',
'another.php',
'more.php');
if (!in_array($page, validpages)){
// Abort the script
// You should probably write a log message here too
die("Invalid request");
}
instead of:
$valid_pages = array(
"apage.php" => "",
"another.php" => "",
"more.php" => "");
if (!isset($valid_pages[$page])) {
// Abort the script
// You should probably write a log message here too
die("Invalid request");
}
Yours
Gustavo el Geranie
|
Showing messages 1 through 1 of 1.
-
Nicer code
2009-01-23 20:03:51
NinjaTech
[View]