Jump to content
Larry Ullman's Book Forums

$_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.

Link to comment
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.

Link to comment
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).

Link to comment
Share on other sites

 Share

×
×
  • Create New...