PHP getting address

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.

use sessions

oops, or cookies would work too.

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.

$PHP_SELF gets the name of the current page. just set a variable to that and redirect.

Thanks, and thanks for pointing me to sessions. I was using cookies but I think sessions would be the better choice.

no problem. Post back if you have a problem.