Note Submitter: zaphod at StripspaM gresak dot net
----
A basic and simple feature to make sure a script is
available only for inclusion and can not be accessed
directly via url.
Include this snippet before the beginning of the script on
the top of your page:
<?
if (basename($_SERVER['PHP_SELF']) == basename ( __FILE__
) ) {
$home = 'http://' . $_SERVER['SERVER_NAME'] . '/';
header ("Location: $home");
die();
}
?>
Instead of redirecting to homepage you could of course do
anything else like send a 404 or 403 header.
--
PHP Notes Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php
|