Page 1 of 1

Checking what page the user came from..?

Posted: Thu May 22, 2003 9:36 am
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.

Posted: Thu May 22, 2003 11:38 am
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.