I have a php file that I include in my php script, but I don\'t want people to be able to directly run the file(without being included).
How can I prevent that from happenin
I use a sentinel constant, defined in the "including" script, and the "included" script looks for it.
Example:
/* main.php */
define('SENTINEL', 1);
include "included.inc.php"
/* included.inc.php */
if (!defined('SENTINEL')) die("Wanted to be smart?? Nice try.");