Page 1 of 1

Where am I?

Posted: Thu Mar 20, 2003 7:47 am
by Gen-ik
Using

Code: Select all

var my_location = window.location.href
in JavaScript allows you to find out the current path/location of the page...

...is there anything in PHP which can do the same thing?



Thanks.

Posted: Thu Mar 20, 2003 7:53 am
by twigletmac
$_SERVER['PHP_SELF']?

Mac

Posted: Thu Mar 20, 2003 8:30 am
by Gen-ik
Nice one.

Thanks.

Posted: Tue Apr 22, 2003 10:01 am
by Gen-ik
On a similar thread is it possible for PHP to detect which page or URL is calling it?

I am trying to work out how to make a PHP file check where it is being included() from.. and then do something depending on the result.

If it's being included() from a page on my server then it will do on thing.. if it's being included() or run from anywhere else then it will do another.

Any ideas :?:

Posted: Tue Apr 22, 2003 10:12 am
by volka
$_SERVER['HTTP_REFERER']
a description of all those variables can be found at http://www.php.net/manual/en/reserved.variables.php
For $_SERVER['HTTP_REFERER'] it's worth reading the notes there.