On my server I have directory “reset”, which contains 3 files index.php , 1.php, 2.php.
index.php includes the following code:
if (condition) {
include_once "1.php";
} else {
include_once "2.php";
}
User still can open files for inclusion directly from directory reset/1.php
How to automatically redirect user from this files to index.php ?
If in the filename of script currently executing,
1.phpis found, redirect toindex.php.http://codepad.org/dE0zplUN Note, in codepad.org sample, I have changed
1.phptot.php, because as of writing this, codepad.org site uses this file name as the main/executing script.Edit this to any filename you required.
You could also have a look at $_SERVER[‘PHP_SELF’].