note 44990 deleted from function.defined by tomsommer
| From: | tomsommer@php.net | Date: | Sun, 22 Aug 2004 17:57:04 +0000 |
| Subject: | note 44990 deleted from function.defined by tomsommer | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-75122@lists.php.net to get a copy of this message | ||
Note Submitter: corey at coreyholzer dot com
----
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