Page 1 of 1

Last URL (source) ?

Posted: Sun Sep 01, 2002 5:08 am
by gite_ashish
Hi,

How to find the last URL.

Like, i have one Anchor tag in many pages ( <A hRef=next.php> click </A> ). But the link that opens up (next.php) is same everywhere.

In the next.php how can i find, from which page i have been open.


:!: The simplest way i got is to add one query string variable in every Anchor tag to identify the last page. But, is there any other smart way ?!?!
Is any HTTP header that can give these details ?


Thanks & Regards,

Posted: Sun Sep 01, 2002 6:13 am
by twigletmac
You could use $_SERVER['HTTP_REFERER'] but:
php manual wrote:'HTTP_REFERER'
The address of the page (if any) which referred the user agent to the current page. This is set by the user agent. Not all user agents will set this, and some provide the ability to modify HTTP_REFERER as a feature. In short, it cannot really be trusted.
Probably best to pass a variable in the URL.

Mac

Thanks !

Posted: Sun Sep 01, 2002 7:31 am
by gite_ashish
Hi,

Yes, got what i was looking for.

I checked this variable in IE4/win, IE5/win, IE6/win, nn4.04/win, nn4.08/win, nn4.75/win and lynx-2.8.3-2/rhl6.2 .... it is working.

But $_SERVER[HTTP_USER_AGENT] is NOT reported in phpinfo().

Thanks with best regards,

Posted: Sun Sep 01, 2002 8:01 am
by twigletmac
Yes it can work in almost any browser but the user can modify it or turn it off - it is not reliable and if you need to know which page someone has come from it is not the best method.

Mac