PDA

View Full Version : PHP getting address



Sorcerer
June 26th, 2003, 03:08 PM
Is there anyway for php to copy whatever is in the address bar to a variable or put the name of the current page in a variable?

I have a set of pages which require a login, I have a require command to insert the same login validation code I use for every page. If a user is not logged in the code forewards them to the login page. I would like to be able to once they login redirect them back to the page they were originally trying to reach.

Jubba
June 26th, 2003, 03:16 PM
use sessions

Jubba
June 26th, 2003, 03:18 PM
oops, or cookies would work too.

Sorcerer
June 26th, 2003, 03:42 PM
I'm using cookies right now but I think I'm going to change it to sessions after what I've been reading. What I am looking for is some way to store the address typed into the address bar on the web browser to a session or cookie variable before I send them to the login page, then from the login page I can send them back to that address.

Jubba
June 26th, 2003, 03:47 PM
$PHP_SELF gets the name of the current page. just set a variable to that and redirect.

Sorcerer
June 26th, 2003, 03:49 PM
Thanks, and thanks for pointing me to sessions. I was using cookies but I think sessions would be the better choice.

Jubba
June 26th, 2003, 03:50 PM
no problem. Post back if you have a problem.