I'm trying to figure out what this process is called. Example: When I'm NOT logged into the site, and I want to click on the action on page 1, it will bring me to the login page. Once I'm logged in, it will forward me back to page 1. How does it remember which state I was in? What is this process called, so I can search for google tutorials?
Store the url in a session variable. when your script logs the user in you can regenerate their session ID without losing the data stored in any session variables by using session_regenerate_id() then, once logged in, simply read the url from the session variable and redirect the user there. If you want to preserve the exact state of the page before the user logs in so that you can return the user there afterwards you can put this info into session variables on every page load or put it in the URL like this: www.fatblunt.com/roll_me_a_fat_one.php?page=somepage&id=23&sort=asc&is_my_blunt_fat=yes&got_munchies=yes Code (markup): When returned to this page all the variables can be pulled from the URL and the page setup in the same way as before.
Example action.php needs people to be logged in. In action php do a header("location: login.php") if not logged in. in login.php set a cookie for each visit. cookie stores the url of previous page ($_SERVER[HTTP_REFERRER]) Once login is successful, redirect to url in cookie. Write empty string in cookie when they logout. regards
^Will not make much of a difference. Also, you may have a hidden form field that sends the URL of the page to the login script. If login is successful, the visitor is redirected back.