List Info

Thread: note 61720 added to function.include




note 61720 added to function.include
user name
2006-02-10 09:48:59
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.
----
Server IP: 193.77.159.244
Probable Submitter: 193.77.114.1
----
Manual Page -- htt
p://www.php.net/manual/en/function.include.php
Edit        -- http://master.php.net/manage/user-notes.php?action=
edit+61720
Delete: added to the manual -- htt
p://master.php.net/manage/user-notes.php?action=delete+61720
&report=yes&reason=added+to+the+manual
Delete: bad code            -- http://master.
php.net/manage/user-notes.php?action=delete+61720&report
=yes&reason=bad+code
Delete: spam                -- http://master.php.
net/manage/user-notes.php?action=delete+61720&report=yes
&reason=spam
Delete: useless             -- http://master.p
hp.net/manage/user-notes.php?action=delete+61720&report=
yes&reason=useless
Delete: non-english         -- http://mast
er.php.net/manage/user-notes.php?action=delete+61720&rep
ort=yes&reason=non-english
Delete: already in docs     -- http://
master.php.net/manage/user-notes.php?action=delete+61720&
;report=yes&reason=already+in+docs
Delete: other reasons       -- http://master.php.net/manage/user-
notes.php?action=delete+61720&report=yes
Reject      -- http://master.php.net/manage/user-
notes.php?action=reject+61720&report=yes
Search      -- http://ma
ster.php.net/manage/user-notes.php

-- 
PHP Notes Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php

note 61720 deleted from function.include by aidan
user name
2006-04-15 16:23:12
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

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )