datadoit.com
|
| Posted: 08/16/2007, 7:12 PM |
|
CCS3.1, PHP5, MySQL5
Does anyone know of a magical way to redirect the page if someone
attempts to view an includable page directly?
Ex: Someone, for whatever crazy reason, attempts to browse to http://www.mywebsite.com/includes/header.php, so I want to redirect them
to the index.php page instead. However, header.php still needs to work
normally as an includable page.
Would prefer something that could be put somewhere in Common.php, and
not have to update every single includable page.
Gracias.
|
|
|
 |
wkempees
Posts: 1679
|
| Posted: 08/17/2007, 5:14 AM |
|
Nice one.
You would probaly test for the PHP_SELF not being the name of the include file.
in which case you redirect.
Quote :
Server variables: $_SERVER
....
'PHP_SELF'
The filename of the currently executing script, relative to the document root. For instance, $_SERVER['PHP_SELF'] in a script at the address http://example.com/test.php/foo.bar would be /test.php/foo.bar. The __FILE__ constant contains the full path and filename of the current (i.e. included) file.
Just quick of the back of the head.
Walter
_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)
if you liked this info PAYPAL me: http://donate.consultair.eu
|
 |
 |
|