Prevent Direct Access to ! index.php
Posted: Wed Nov 23, 2011 5:02 pm
I'm working on a site where are scripts are loaded through index.php
What is the best way to prevent people from accessing other scripts on the site directly?
I'm currently using something like this:
Don't worry about security_filter() so basically I'm using:
in every page to prevent people from directly accessing other scripts.
What is the best way to prevent people from accessing other scripts on the site directly?
I'm currently using something like this:
Code: Select all
if (security_filter($_SERVER['PHP_SELF'],"string") != "/index.php"){ echo "ACCESS DENIED"; exit(); }Code: Select all
if ($_SERVER['PHP_SELF'] != "/index.php"){ echo "ACCESS DENIED"; exit(); }