Checking what page the user came from..?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Drachlen
Forum Contributor
Posts: 153
Joined: Fri Apr 25, 2003 1:16 am

Checking what page the user came from..?

Post by Drachlen »

Hello, I'm interested in using PHP to check what the users previous page was, I've used yahoo and have tried searching but I'm not sure what keywords I need to use and I couldn't come up with anything. Basically i want to make sure they come from a specific page, and if they dont, it forwards them there. Lets say they goto PAGE 2, but I don't want them to goto PAGE 2 without going to PAGE 1 first. if they go directly to PAGE 2 it automatically forwards them to 1. I was thinking, maybe page 1 could hold a cookie, and page 2 checks for it, and if it finds it, it accepts them, and removes it? I wouldn't know how i would go about setting that up though.
User avatar
daven
Forum Contributor
Posts: 332
Joined: Tue Dec 17, 2002 1:29 pm
Location: Gaithersburg, MD
Contact:

Post by daven »

Check out $_SERVER['HTTP_REFERER']
http://www.php.net/manual/en/reserved.v ... les.server

It contains the address of the previous page the user accessed.
Post Reply