login and come back to the previous 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
User avatar
sutejok
Forum Commoner
Posts: 37
Joined: Wed Mar 24, 2004 4:08 pm

login and come back to the previous page?

Post by sutejok »

Is there a way by php, so that i can mark down the address on which i am on? i mean the actual address that is shown on the address bar.

I'm trying to make a website, where ppl can log in and out. My problem is, i want ppl to be able to log in from any page of the website, and after the log in, they will be back to the last page where they were, when they are trying to log in.

is there a way to track the actual address? or is there better way to do this?
User avatar
PrObLeM
Forum Contributor
Posts: 418
Joined: Sun Mar 07, 2004 2:30 pm
Location: Mesa, AZ
Contact:

Post by PrObLeM »

in the login form have a hidden value of the page they are in when its submited and they are loged it send them back by using:

header("Location: $hidden_value");
User avatar
sutejok
Forum Commoner
Posts: 37
Joined: Wed Mar 24, 2004 4:08 pm

Post by sutejok »

is there a way for php to automaticly know whatever is on the address bar?
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

header("Location: ".$_SERVER['HTTP_REFERER']);
exit;

That should send them back to the refering page, ie where they were before they logged in.
Post Reply