Where am I?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Gen-ik
DevNet Resident
Posts: 1059
Joined: Mon Aug 12, 2002 7:08 pm
Location: London. UK.

Where am I?

Post 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.
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

$_SERVER['PHP_SELF']?

Mac
Gen-ik
DevNet Resident
Posts: 1059
Joined: Mon Aug 12, 2002 7:08 pm
Location: London. UK.

Post by Gen-ik »

Nice one.

Thanks.
Gen-ik
DevNet Resident
Posts: 1059
Joined: Mon Aug 12, 2002 7:08 pm
Location: London. UK.

Post 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 :?:
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post 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.
Post Reply