Test If File Is Included

Description: This tests to see if the current file is being included or run directly. It’s useful to add to the top of your include files to stop malicious users from accessing them directly in the browser.

<?PHP
 
IF(__FILE__ == $_SERVER['SCRIPT_FILENAME'])
    DIE("This file cannot be executed directly");
 
?>

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.