tqla Posted April 2, 2008 Share Posted April 2, 2008 Hello. I have a link that links to a file. One can click on that link and see the file but only if they are logged in. If they are not logged in they are redirected to a login page. Once they successfully log in they are automatically taken to the file. This works fine. This is what's in the address bar during this process, it automatically shows the folder and php page where the file is located: http://ufjfurjtrigj.com/resource_center/insight/MRLlogin.php?accesscheck=%2Fresource_center%2Fpdfs%2FTechnology_Adoption.php On this same login page I have a link to a signup page that they can use if they don't already have a username and password. What I want to do is carry the same URL to the registration page, or in other words, register the "accesscheck" variable so that after they successfully register they will automatically be taken to the file too. How can I register this variable when the user clicks on the signup page link? After I register the variable I will use header("Location: " . $accesscheck); to get to the page. (I think) Ya know what I mean? Thanks. Quote Link to comment Share on other sites More sharing options...
p2grace Posted April 2, 2008 Share Posted April 2, 2008 Save the address to a session variable and then redirect to the session variable after registering. Quote Link to comment Share on other sites More sharing options...
tqla Posted April 2, 2008 Author Share Posted April 2, 2008 Thanks p2grace. That's what I thought. How do you do that? How do I carry and save the "accesscheck" variable in this URL to the new page? http://ufjfurjtrigj.com/resource_center/insight/MRLlogin.php?accesscheck=%2Fresource_center%2Fpdfs%2FTechnology_Adoption.php Quote Link to comment Share on other sites More sharing options...
trq Posted April 2, 2008 Share Posted April 2, 2008 <?php session_start(); if (isset($_POST['accesscheck'])) { $_SESSION['accesscheck'] = $_POST['accesscheck']; header('Location: http://site.com/somepage.php'); } ?> Then, on somepage.php <?php session_start(); if (isset($_SESSION['accesscheck'])) { $accesscheck = $_SESSION['accesscheck']; } ?> Is that what you meen? Quote Link to comment Share on other sites More sharing options...
tqla Posted April 2, 2008 Author Share Posted April 2, 2008 Yes, but I cannot manually put in the header location because the accesscheck in the URL changes automatically depending on what link they initially clicked. How do I get the info from the URL? The URL will have the correct previous URL info. Quote Link to comment Share on other sites More sharing options...
trq Posted April 2, 2008 Share Posted April 2, 2008 <?php session_start(); if (isset($_POST['accesscheck'])) { header('Location: ' . $_POST['accesscheck']); } ?> Quote Link to comment Share on other sites More sharing options...
tqla Posted April 2, 2008 Author Share Posted April 2, 2008 Ah Ha! Thanks Thorpe!!!!!!!!!!!!!!!! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.