Jump to content

[SOLVED] How to get URL of previous page..


Guest kilbad

Recommended Posts

I have an authentication script which, currently, once someone logs in, will give a message stating they have been logged in successfully.  However, instead, I want to have it redirect the user to the page they came from. 

Therefore, I wanted to know how I can "grab" the last URL of the page the user came from?  If I have that, I could then redirect them back.

Thank you all so much in advance!

Brendan
Link to comment
https://forums.phpfreaks.com/topic/33631-solved-how-to-get-url-of-previous-page/
Share on other sites

Thanks for the quick response!

I posted your script at [url=http://www.kilbad.com/DEVELOPMENT/test.php]http://www.kilbad.com/DEVELOPMENT/test.php[/url], but it is giving me some weird behavior.. not echoing the page when I come from somewhere else on kilbad.com..

and ideas?

Thanks again!
works for me. the $_SERVER['HTTP_REFERER'] works via hyperlinks, so simply just going to a different address/hitting the back/forward buttom won't have the desired effect as far as i know.

I tried the link you provided. I also skipped to http://www.kilbad.com/DEVELOPMENT/ and clicked on the test.php link, and all worked fine.

I believe some browsers can be set up to mask the HTTP_REFERER though, so it'd be worth checking whether thats why it's not showing it for you.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.