[ciapug] code: What page am I on?

Chris Hettinger ciapug@cialug.org
Thu, 25 Sep 2003 11:18:04 -0500


I'm struggling with something that is probably pretty easy.

URL:  www.somedomain.com/directory/directory/page.php

In my script I want to determine if I am on a specific page, then I show =
some thing different.

<?

// $_SERVER['PHP_SELF'] =3D /directory/directory/page.php

if ($_SERVER['PHP_SELF'] =3D "page.php"){
 echo "You are on page.php";
}

?>

How do I approach cutting $_SERVER['PHP_SELF'] down to page.php.

I considered using: explode("/",$_SERVER['PHP_SELF']);

Or by finding the last (right most) "/" and then taking the rest of the =
string as the file name...=20



-Chris Hettinger, Web Specialist
-IFMC/ENCOMPASS
-www.encompas.com
-(515) 223.2947




CONFIDENTIALITY NOTICE:  This communication, including any attachment, =
may contain confidential information and is intended only for the =
individual or entity to whom it is addressed.  Any review, =
dissemination, or copying of this communication by anyone other than the =
intended recipient is strictly prohibited.  If you are not the intended =
recipient, please contact the sender by reply email, delete and destroy =
all copies of the original message.'