Jump to content
Larry Ullman's Book Forums
Sign in to follow this  
chris14

$_Session Variable Problem After Paypal Return

Recommended Posts

When someone pays using PayPal, they return to my Thanks.php page, and SOMETIMES this exits because the $_SESSION[reg_user_id'] is not set.

I am using the code from Larry's book.

 

About half the times it all works OK.

 

Before I go to PayPal I make sure that the Session variable is set.

 

Any suggestions as to why it sometimes remains set, and sometimes gets unset?

ie. I do not know enough about what could cause this. As far as I can see, I am doing exactly the same thing each time.

 

The rest of the POST variables from PayPal are correctly set, so as a temporary measure I will take out the check for the $_SESSION variable being set.

Share this post


Link to post
Share on other sites

After a bit of further reading on the internet, it is suggested that session_start() must be the very first thing on the page.

 

In may current code (ie. the config.inc.php ) there are a few lines of code (and lots of remarks which I presume do not matter) before the session_start(). Could this cause such an intermittent problem??

 

I will do some tests.

Share this post


Link to post
Share on other sites

My Thank you page mirrors Larry's code also.

 

It starts with redirect_invaliduser('reg_user_id');

 

The redirect_invalid_user function does:

if (!isset($_SESSION['reg_user_id'])) {

echo "Error -- reg user no set"; (well I just made that up:-)

 

Anyway, SOMETIMES there is no error,

but SOMETIMES reg_user_id is not set.

(I checked and it is not set in the Thankyou page either).

Share this post


Link to post
Share on other sites

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.   Paste as plain text instead

  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.

Loading...
Sign in to follow this  

×
×
  • Create New...