Quick Search:
 
 PHP Code: Test If File Is Included Jump to:  
Category: >> PHP Code >> Test If File Is Included  

<< lastnext >>

Snippet Name: 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.

Comment: (none)

Language: PHP
Highlight Mode: PHP
Last Modified: March 16th, 2009

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


 
   Home |    Search |    Code Library |    Sponsors |    Privacy |    Terms of Use |    Contact Us © 2003 - 2024 psoug.org