Page 1 of 1

login and come back to the previous page?

Posted: Wed Mar 24, 2004 4:08 pm
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?

Posted: Wed Mar 24, 2004 4:17 pm
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");

Posted: Wed Mar 24, 2004 7:47 pm
by sutejok
is there a way for php to automaticly know whatever is on the address bar?

Posted: Wed Mar 24, 2004 7:51 pm
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.