zang8027 Posted February 10, 2009 Share Posted February 10, 2009 I got this shopping cart set up and these sessions set up. Now, if the user logs in.. the session is set to that user. So say I log in, order something, and hit buy.. when the user hits buy, it takes the user to paypal, thus leaving my site and destroying the session it seems. Is there anyway I can have it not destroy the session? Maybe cookies? Because im using paypals IPN to send back information to my site and adding this to a database. Im saying <?php if(isset($_SESSION['priv'])) { //Retrieve the values being sent like the date, gross cost, and product //then, connect to the database, table receipts, and add these values where userID = {$_SESSION[priv]} } ?> As you can tell.. its not going to work if my session is destroyed when it sends to paypal. Any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/144679-so-a-weird-situation-with-my-shopping-cart/ Share on other sites More sharing options...
Caesar Posted February 10, 2009 Share Posted February 10, 2009 The sessions should not be destroyed, unless the browser is being closed, or you probably can't print out the values if you're not initiating the session again in the script/page they are coming back to. If you aren't, then the session variables won't be recognized. session_start() Quote Link to comment https://forums.phpfreaks.com/topic/144679-so-a-weird-situation-with-my-shopping-cart/#findComment-759172 Share on other sites More sharing options...
zang8027 Posted February 10, 2009 Author Share Posted February 10, 2009 hmm thats what i thought but i got session start at the top. But once i go from paypal back to my site, its not logged in. Its weird that its doing this Quote Link to comment https://forums.phpfreaks.com/topic/144679-so-a-weird-situation-with-my-shopping-cart/#findComment-759236 Share on other sites More sharing options...
gizmola Posted February 10, 2009 Share Posted February 10, 2009 Does it work if you have another page on your site? It probably has nothing at all to do with paypal. I hope you realize that the session mechanism requires cookies for this to work. The session mechanism needs to set a valid cookie for your site on the client, that has the session id in it. It sounds like the problem is that a cookie is not being set, so when the client returns from paypal, there was no cookie on the client to read. Quote Link to comment https://forums.phpfreaks.com/topic/144679-so-a-weird-situation-with-my-shopping-cart/#findComment-759242 Share on other sites More sharing options...
Caesar Posted February 10, 2009 Share Posted February 10, 2009 Can you show us the code where you're setting the session variable in question? Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/144679-so-a-weird-situation-with-my-shopping-cart/#findComment-759247 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.