![]() |
$_SERVER['REQUEST_URI'] question
I'm trying to write an include that needs to 'know' where it's being called from. In the case of nested includes, we want the original parent. For example, if the include in question is i1.php and it is included in a file called i2.php, which is in turn included by parent.php, we need to find parent.php, not i2.php.
Does $_SERVER['REQUEST_URI'] do this reliably? This is a security question; we need it to be foolproof. My understanding is that REQUEST_URI will always return the full path from the server's root directory of the file that was accessed by an end user. Is this correct? Online documentation I've found via Google is somewhat inconclusive. |
No, it won't point to a PHP file reliably. The REQUEST_URI item in the $_SERVER array only contains the URI of the request, which needn't necessarily point to any individual file. An example of this would be the "SE Friendly" URLs here on TalkPHP (e.g. http://www.talkphp.com/general/2511-_server-request_uri-question.html) which don't point to an HTML file at all.
|
I guess you already asked this question solistus. :-)
http://www.talkphp.com/advanced-php-...-included.html |
Well, I asked a similar question, but was abandoned after one incorrect response. I thought I'd try my luck again. Anyone know a way to do this?
|
I hate to bump, but it's been a few days... Any suggestions, anyone?
|
| All times are GMT. The time now is 08:31 AM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0