Jump to content

Session returns different variables with same SID


phpshift

Recommended Posts

I have two pages on the same domain in the same directory. I am simply using session_start() at the top of my pages, not linking pages with ?SID or anything like that. I have two pages and when I check session_id(), I get the same value on both pages. But I used a foreach() to show all the session variables and the two pages have different variables showing up.  Does anyone know any reason that this would be happening and how to fix it?

 

I'm trying to set up a signup that spans multiple pages and after a couple pages, it's losing the variables for some reason. Any help would be appreciated.  Thanks.

Link to comment
Share on other sites

Well, right now, they're both running the same exact script for debugging.  All the variables used for both were set in the same session but they come up different. Here is my debugging code:

session_start();

print session_id()."<br>";

foreach($_SESSION as $k=>$v)

{

  print "\$_SESSION[\"".$k."\"]=\"".$v."\";<br>";

}

die();

 

 

The results for the first page:

 

96bddc7f6b567feecf259efe354f7694

$_SESSION["sessiontest"]="Sessions work";

$_SESSION["npr_step"]="0";

$_SESSION["dynamicID"]="c51ce410c124a10e0db5e4b97fc2af39";

$_SESSION["image_location"]="068004fef1759529ff6f29015cde17cd3d36cae69bf7face8bc5b10f5d50db67.png";

 

And the second:

 

96bddc7f6b567feecf259efe354f7694

$_SESSION["npr_step"]="2";

$_SESSION["uniqueID"]="940392f5f32a7ade1cc201767cf83e313c6d2f0916bd1e44c75cbe82fb29d95eeb5b26b95721336140a6af3cd092da02a536fb5480db8bdbb84daffe345c675b";

 

 

@markwillis82

I thought about that and checked. My cookies are set to accept all. Also, two of my pages are reading the same session variables just fine.  But it seems that after those two pages, it forgets the variables whether I run other scripts or not.  Also, all pages return the same session ID.

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.