zang8027 Posted February 11, 2009 Share Posted February 11, 2009 on my site, i am setting 2 sessions. Now, if you log in, it sets a session called 'priv'. If you click buy, it takes you to paypal, you go through that, and then once the order is complete, paypal uses a instant notfication to send certain values back to whatever page i tell it to. So, assuming you logged in, and the session was set, this should be registered right?: <?php session_start(); //We need to first grab the information being passed $date = $_REQUEST['payment_date']; $cost = $_REQUEST['mc_gross']; $restaurant = $_SESSION['rest']; $user = $_SESSION['priv']; if(session_is_registered('priv')){ $myFile = "./payments.log"; $fh = fopen($myFile, 'a') or die("Cannot Connect to Log"); $v = "$user was set \n"; fwrite($fh, $v); fclose($fh); }else{ $myFile = "./payments.log"; $fh = fopen($myFile, 'a') or die("Cannot Connect to Log"); $v = "$user $restaurant No session registered \n"; fwrite($fh, $v); fclose($fh); } It doesn't. I can echo out the session and get the proper value but when paypal sends back to this page (which is never opened, so the user never sees this page.. its all behind the scenes), the session is no longer set. Im stumped... any ideas on how I can save the session data? I would write it to a file BUT there could be multiple orders going on at once so the session that I write to a .txt file would be over written. The end goal is to grab the order information that paypal is sending back, connecting to a database, and add the stuff to a table where userID = {$_SESSION['priv']}; Link to comment https://forums.phpfreaks.com/topic/144800-session-not-saved/ Share on other sites More sharing options...
grissom Posted February 11, 2009 Share Posted February 11, 2009 I had very similar issues when I had one web-page embedded inside another using the <OBJECT> tag. Bizarrely, the session variable was kept in Firefox but not IE, this was utterly WEIRD since PHP, as you probably already know is run on the SERVER - and therefore the browser should not have made a scrap of difference. But it did !!!!!! I tore my hair out over it and lost quite a bit of sleep that night trying to fix it. The alarm bells rang a bit for me when you said "this goes on behind the scenes" which is similar to what I was trying to do. The only answer in the end was to NOT do it behind the scenes and to figure out another way of doing it. Also, the bouncing back to and fro from paypal may be re-setting your session variables. One alternative is to try saving the info in a browser-side cookie. Another is to quickly poke the variable into a mysql database and then dig it out again later. But be warned - IE8 does weird unexpected things with this technique as I found to my intense frustration. Link to comment https://forums.phpfreaks.com/topic/144800-session-not-saved/#findComment-759911 Share on other sites More sharing options...
trq Posted February 11, 2009 Share Posted February 11, 2009 session_is_registered has long been depricated. I would use.... if (isset($_SESSION['priv']) { and see if your issue persists. Link to comment https://forums.phpfreaks.com/topic/144800-session-not-saved/#findComment-759960 Share on other sites More sharing options...
The Little Guy Posted February 11, 2009 Share Posted February 11, 2009 session_is_registered has long been depricated. I would use.... if (isset($_SESSION['priv']) { and see if your issue persists. You forgot a parenthesis if (isset($_SESSION['priv'])) { Link to comment https://forums.phpfreaks.com/topic/144800-session-not-saved/#findComment-759992 Share on other sites More sharing options...
zang8027 Posted February 11, 2009 Author Share Posted February 11, 2009 ya i tried that too and did not work. Link to comment https://forums.phpfreaks.com/topic/144800-session-not-saved/#findComment-760044 Share on other sites More sharing options...
The Little Guy Posted February 11, 2009 Share Posted February 11, 2009 <?php session_start(); if(isset($_SESSION['priv'])){ echo 'im set!'; }else{ echo 'im not set'; } ?> Link to comment https://forums.phpfreaks.com/topic/144800-session-not-saved/#findComment-760047 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.