Jump to content

Wrong session


ediehl

Recommended Posts

I'm a newbie at php, having difficulties with starting different sessions when I didn't want to. I decided that it must be because I had the same page calling itself for different purposes, each time calling session_start at the start. I thought I could get around the problem by splitting the code up so that each php page only called session_start once rather than multiple times.

 

But I did that, and it's still not working.

 

The bottom line is that I start the session and successfully set the session var in one php file.  then go to PayPal and PayPal responds by calling two different php files of mine. In the first to get called the session_ID after session_start is different from the original, but in the second it's the same, and the set variables are accessible.

 

I tried testing if the session was open and only calling session_start if not, but it still started a new session, where my set vars are not visible.

 

Is there a way to force a file to open a specific session? Or am I off on the wrong track?

Link to comment
https://forums.phpfreaks.com/topic/145120-wrong-session/
Share on other sites

you can store the session information in DB and pass the session id to paypal as a parameter to be returned.

on the returning URL u will get the session id back from Paypal. you can retrive information using that session_id from database and set the session variables back.

 

hth

Link to comment
https://forums.phpfreaks.com/topic/145120-wrong-session/#findComment-761730
Share on other sites

Thanks! I talked with someone else who had web development experience, and he told me what I should have known and basically what I think you are saying---that web sessions are essentially stateless, and that a 'session' is associated with a specific browser (I think via a cookie?). In any case, a call from PayPal will not be seen as belonging to my browser session, and that is why it's not seeing my session vars. So the answer is to store data in MySQL and have a key value in the data sent-to and returned-from PayPal, so that I can later relate the PayPal response to the prior db entry.

 

At least that's what I think for now...

 

Thanks again,

Eric

Link to comment
https://forums.phpfreaks.com/topic/145120-wrong-session/#findComment-762095
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.