referral page

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
theclay7
Forum Commoner
Posts: 50
Joined: Wed Feb 19, 2003 3:17 am

referral page

Post by theclay7 »

I am writing a forum add, f_add.php where it will check if the person has already login or not, if no, then it will go to the login page and then going back to the previouse f_add.php...

my problem is when the f_add.php directs the user to login.php, I use $_SERVER['HTTP_REFERER'] to remember the page it comes in, but it is not the f_add.php page but the page i visited before f_add.php....

so how can I implement this, so the user can login and redirect to the page they have requested?
Malder
Forum Newbie
Posts: 13
Joined: Wed Mar 19, 2003 11:09 pm

Post by Malder »

You can use somth like this:

//f_add
...
header('login.php?prev=f_add.php');

//login
...
if isset('{$_GET["prev"]}') header('{$_GET["prev"]}');
Post Reply