I am looking online for this the whole weekend but cannot find anything so I am starting to think it is either not possible or it is just that I cannot figure it out.
The case is the following:
There is a form on Page 1. Upon submission, the form information is stored in a $_SESSION
and the user is directed to Page 2. There are several hundred queries on Page 2 that read the $_SESSION
content and display certain results based on this content.
What I am trying to do is to skip Page 1, and direct the user straight to Page 2, where he could see some results that I want to predefine for him. I want to do this by loading a pre-saved $_SESSION
data, either from a file or by placing it directly in the PHP file (is this even possible?)
Here is the code on Page 2, that I use to Get the $_SESSION
from Page 1. What modifications should I do to it to load a session file of my choice or even better load the session content straight on Page 2:
unset($_SESSION);
//I add this value first to unset any previous sessions the user might have and then I am not sure how to proceed.
if(isset($_GET['sid']) && $_GET['sid'] != ''){
if(isset($_SESSION['pageRedirct']) && $_SESSION['pageRedirct'] != ''){
unset($_SESSION['pageRedirct']);
}
$sid = base64_decode($_GET['sid']);
$save_srch = $db->GetRow("SELECT * FROM ".$tblprefix."search_save WHERE id = $sid");
$pageRedirct = $save_srch['search_page'];
$_SESSION['pageRedirct'] = $pageRedirct;
To provide some info why I need to do this - there are several hundred variables on Page 1 that are required to properly display Page 2 so I just want to copy one $_SESSION
and use it to directly load Page 2, instead of manually setting all required variables on Page 2 (which will take enormous amount of time).
If I am not explaining something well let me know to edit my question.
Any ideas comments will be appreciated. Thank you!!