Forum Moderators: coopster

Message Too Old, No Replies

Obtaining URLs

How do I obtain the previous page's URL

         

Weirfire

10:01 am on Oct 19, 2004 (gmt 0)

10+ Year Member



I was wondering if anyone knows how to extract the previous pages URL with PHP. This will only be needed for pages in which users have clicked through to the page where i would like to track the previous URL.

Weirfire

10:22 am on Oct 19, 2004 (gmt 0)

10+ Year Member



I found it.

It's $_SERVER['HTTP_REFERRER'] for anyone who is interested. :)

jatar_k

6:39 pm on Oct 19, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld Weirfire,

keep in mind that the referrer isn't 100% reliable. You may only get it about 70 - 80% of the time.

lazydog

8:53 pm on Oct 20, 2004 (gmt 0)

10+ Year Member



Hi jatar_k!

You may only get it about 70 - 80% of the time.

What does that mean? Where is this stat. coming from?

Saurabh.

coopster

10:21 pm on Oct 20, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



This thread should provide some enlightenment...

[webmasterworld.com...]

...starting at msg #4

Weirfire

11:05 pm on Oct 20, 2004 (gmt 0)

10+ Year Member



Thank you for the welcome and thank you for the info :)

lazydog

5:07 am on Oct 21, 2004 (gmt 0)

10+ Year Member



Nothing new there :). I misread jatar_k's earlier post.
I thought he said that PHP was unreliable, but its not.

Whenever a referer is sent by the client, PHP makes it available in HTTP_REFERER. I guess he's saying that only 80% of the requests will send a referer.

Weirfire

8:50 am on Oct 21, 2004 (gmt 0)

10+ Year Member



Yeah. What I was trying to do was let someone login from any page and then redirect to the page they were originally on. I could just put the login script on every page but that is time consuming when I can just redirect.

coopster

11:53 am on Oct 21, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member




Nothing new there :) I misread jatar_k's earlier post.
I thought he said that PHP was unreliable, but its not.

I don't think you'll hear him say that ;)


Whenever a referer is sent by the client, PHP makes it available in HTTP_REFERER. I guess he's saying that only 80% of the requests will send a referer.

I do believe that is what he meant.

timster

4:05 pm on Oct 21, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



let someone login from any page and then redirect to the page they were originally on

You could accomplish this without relying on referer in a couple ways. You could store the current page in a session variable, or pass it to the login script in hidden form data.

jatar_k

7:14 pm on Oct 21, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



>> I do believe that is what he meant.

that is correct

>> I thought he said that PHP was unreliable

I'd have to get a new career if I even considered it ;)

>> then redirect to the page they were originally on

go for it, then just redirect to a default page if the referrer isn't set. Most users will end up exactly where they were.