Page is a not externally linkable
- Code, Content, and Presentation
-- PHP Server Side Scripting
---- Calling a file in php


penders - 11:10 am on Jun 29, 2009 (gmt 0)


if(stristr($_SERVER['REQUEST_URI'], "home/beta/public_html/"))  
$folder = "home";

This is never going to evaluate to true since "home/beta/public_html/" (the server-side path) is never going to be part of the REQUEST_URI (client-side URL as seen in the browser).

I simply want to target the index.php on my server which is located in the root...

To target just the file, you could do:

if ($_SERVER['PHP_SELF'] == '/index.php') 
$folder = 'home';

To check if you are in any file in the web root, you could check for any more '/' after the first one in PHP_SELF, if there are then you are in a sub folder, if not then you are in the web root.

if (strpos($_SERVER['PHP_SELF'],'/',1) === false) 
$folder = 'home';


Thread source:: http://www.webmasterworld.com/php/3941884.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com