TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 03-23-2008, 06:26 PM   #1 (permalink)
The Wanderer
 
Join Date: Nov 2007
Posts: 9
Thanks: 1
solistus is on a distinguished road
Arrow $_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.
solistus is offline  
Reply With Quote
Old 03-23-2008, 10:00 PM   #2 (permalink)
Moderateur
RegEx Guru PHP Guru Top Contributor Advanced Programmer 
 
Salathe's Avatar
 
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
Salathe is on a distinguished road
Default

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.
Salathe is offline  
Reply With Quote
Old 03-23-2008, 11:38 PM   #3 (permalink)
The Contributor
 
DeMo's Avatar
 
Join Date: Jan 2008
Location: Brazil
Posts: 77
Thanks: 14
DeMo is on a distinguished road
Default

I guess you already asked this question solistus.
Can an included file 'know' where it's been included?
Send a message via ICQ to DeMo Send a message via MSN to DeMo Send a message via Skype™ to DeMo
DeMo is offline  
Reply With Quote
Old 03-27-2008, 05:22 PM   #4 (permalink)
The Wanderer
 
Join Date: Nov 2007
Posts: 9
Thanks: 1
solistus is on a distinguished road
Default

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?
solistus is offline  
Reply With Quote
Old 04-01-2008, 09:31 PM   #5 (permalink)
The Wanderer
 
Join Date: Nov 2007
Posts: 9
Thanks: 1
solistus is on a distinguished road
Arrow

I hate to bump, but it's been a few days... Any suggestions, anyone?
solistus is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 07:05 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design