PDA

View Full Version : Current Page



nikomou
07-23-2006, 09:26 AM
Hi,

Is there a way to find out (using php) what page a visitor is currently on?

e.g. the visitor is on http://www.thisurl.com/this_page.html, i want to use this info within the site as $currenturl

Did i explain that well?!?
Cheers.

Twey
07-23-2006, 01:16 PM
The global variables $PHP_SELF and $_SERVER['REQUEST_URI'] and the constant __FILE__ should help you.

nikomou
07-24-2006, 01:01 AM
Thanks Twey, but that only shows the file names or root..

I want to be able to see the exact url.

is that possable?

Cheers.

Twey
07-24-2006, 01:14 AM
You can work out the URL. It's
'http://' . $_SERVER['HOST'] . '/' . $_SERVER['REQUEST_URI']