Forum Moderators: coopster

Message Too Old, No Replies

PHP: how to get the last page visited...

for an if statement.

         

freshmold

12:20 am on Apr 5, 2003 (gmt 0)

10+ Year Member



Hi.

Very simple trivia:

What's the best way to determine the last page the user was on - or what page referred the user?

Birdman

1:06 am on Apr 5, 2003 (gmt 0)

freshmold

1:45 am on Apr 5, 2003 (gmt 0)

10+ Year Member



I thought about that, but that variable isn't accurate. Some browsers/systems don't define HTTP_REFERER.

Is there any other way?

ACTUALLY, let me ask another question. I'm trying to set up a "last visited" thing. I was trying to set it up to record the last time someone logged in from the login page via HTTP_REFERER.

What's a good way to set up a "last visited" variable/field?

Birdman

2:52 am on Apr 5, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I would think using cookies [php.net] would work.

digi_mind

7:38 am on Apr 7, 2003 (gmt 0)

10+ Year Member



I don't believe in cookies.

Some users don't allow their browser to create cookies, but their is not a problem anymore because php 4.2 checks if the browser allows cookies, and if it doesn't then it creates one in the server site.

Want I want to say is that the server will create a cookie for you.

An other solution will be that you create a variable that is in every page and passed it to the next page ( ofcourse the variable containd the name of the page you are in ) you are calling, then this new page will know where the user came from.

I hope I make my self clear.

mavherick

7:43 am on Apr 7, 2003 (gmt 0)

10+ Year Member



You could use sessions [php.net] for that. Simply register a variable that holds the last visited page. Sessions work with or without cookies, so you should be fine.

hope that helps

mavherick