Jump to content

[SOLVED] Carry post info to a registration page


tqla

Recommended Posts

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.

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

<?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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.