note 44990 added to function.defined
| From: | corey at coreyholzer dot com | Date: | Sun, 22 Aug 2004 17:55:45 +0000 |
| Subject: | note 44990 added to function.defined | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-75121@lists.php.net to get a copy of this message | ||
Here is a next level approach to protecting your application. I am assuming that each of the pages
is included in the application's main page.
The constant APPLICATION_INDEX is defined in config.php. For argument's sake it could be:
define('APPLICATION_INDEX', '/index.php');
Then security.php which contains the following code:
require_once('config.php');
if (!defined('APPLICATION_INDEX')) {
header("HTTP/1.0 404 Not Found");
exit();
} else if ($_SERVER['PHP_SELF'] != APPLICATION_INDEX) {
header('Location:' . APPLICATION_INDEX);
}
Now all you have to do is require security.php in each of your pages
----
Manual Page -- http://www.php.net/manual/en/function.defined.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+44990
Delete -- http://master.php.net/manage/user-notes.php?action=delete+44990&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+44990&report=yes
Search -- http://master.php.net/manage/user-notes.php