chris14 Posted July 25, 2011 Share Posted July 25, 2011 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 More sharing options...
chris14 Posted July 25, 2011 Author Share Posted July 25, 2011 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 More sharing options...
Jonathon Posted July 25, 2011 Share Posted July 25, 2011 What code are you using in your Thanks.php page Chris? Your config page should be fine as I imagine you will have mirrored Larry's. Link to comment Share on other sites More sharing options...
chris14 Posted July 25, 2011 Author Share Posted July 25, 2011 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 More sharing options...
Recommended Posts