note 76183 added to function.get-included-files

From: Date: Wed, 04 Jul 2007 03:27:04 +0000
Subject: note 76183 added to function.get-included-files
Groups: php.notes 
Request: Send a blank email to php-notes+get-128215@lists.php.net to get a copy of this message
If you have a MAIN php script which you don't want to be included by other scripts, you could use this function. For example: main.php: <?php function blockit() { $buf = get_included_files(); return $buf[0] != __FILE__; } blockit() and exit("You can not include a MAIN file as a part of your script."); print "OK"; ?> So other script couldn't include main.php to modify its internal global vars. ---- Server IP: 222.73.207.144 Probable Submitter: 82.235.148.113 ---- Manual Page -- http://www.php.net/manual/en/function.get-included-files.php Edit -- https://master.php.net/note/edit/76183 Del: integrated -- https://master.php.net/note/delete/76183/integrated Del: useless -- https://master.php.net/note/delete/76183/useless Del: bad code -- https://master.php.net/note/delete/76183/bad+code Del: spam -- https://master.php.net/note/delete/76183/spam Del: non-english -- https://master.php.net/note/delete/76183/non-english Del: in docs -- https://master.php.net/note/delete/76183/in+docs Del: other reasons-- https://master.php.net/note/delete/76183 Reject -- https://master.php.net/note/reject/76183 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#128215) next »