Test If File Is Included

Submitted by:Andery Smith

Date added:16 November, 2014

Category:PHP

Useful php code to see if the current file is being included or run directly.

Tags: test file , useful php code

Code Snippet:

<?PHP

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

?>
 
 

Comments