note 53663 added to function.function-exists

From: Date: Wed, 08 Jun 2005 16:24:24 +0000
Subject: note 53663 added to function.function-exists
Groups: php.notes 
Request: Send a blank email to php-notes+get-90126@lists.php.net to get a copy of this message
To prevent direct calls to included files i use the following technique. In the main file create an empty function with a random name. Like so: <?php function hjudejdjiwe() { return true; } ?> Then check for the existence of this function within your include: <?php if (!function_exists('hjudejdjiwe')) { die('!'); } ?> Simple but effective. ---- Manual Page -- http://www.php.net/manual/en/function.function-exists.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+53663 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+53663&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+53663&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+53663&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+53663&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+53663&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+53663&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#90126) next »