Invalid session, very strange failure.
These two days have been writing PayPal, now quickly put ipn.php complete, but encountered a problem let me very puzzled ah!
Session in ipn.php only part of the valid, see the code
PHP Code
Connect (); $listener = new Ipnlistener (); $listener->use_sandbox = true; er _time=$_session[' order_time_org '];$ username=$_session[' user '];echo "er _time, $username";//to the position above, the SESSION can be used above the output of two can be displayed//below the display does not come out! Why is this? try {$verified = $listener->processipn ();} catch (Exception $e) {//Fatal error trying to process IPN. Exit (0);} if ($verified) {//IPN response was "verified"//send email form $invoice _id=$_post[' Invoice ']; $payment _status = $_post[' payment_status '); $receiver _email = $_post[' Receiver_email '); $payer _email = $_post[' Payer_email '); er _time = $_post[' Custom ']; $whimwin _user=$_session[' user ']; The $_session[' user ' doesn't show up here! if ($payment _status== "completed")//{$query = "UPDATE CART SET payment_status= ' paid ' WHERE username= ' $userna Me ' and order_time= ' er _time ' and invoice_id= ' $invoice _id ' "; $result =querymysql ($query); if ($result) {$to = "[email protected]";//payEr_email//subject $subject = "Whim Win paid successful!"; From $header = "From:test <[email protected]>"; Message body $message = "Dear Member, \ n"; $message. = "This is your Invoice ID $invoice _id \ n"; $message. = "$payment _status, er _time, $payer _email, $receiver _email, $username"; Send email $sendmail =mail ($to, $subject, $message, $header); }//}} else {//IPN response was "INVALID"} $db->close ();? >
------Solution--------------------
Test it first.
try {
Print_r ($_session);
$verified = $listener->PROCESSIPN ();
Print_r ($_session);
} catch (Exception $e) {
Fatal error trying to process IPN.
Exit (0);
}
------Solution--------------------
Leave him alone, cache yourself.
Let's get this over with.
try {
$mysession = $_session;
$verified = $listener->PROCESSIPN ();
$_session = $my _session;
} catch (Exception $e) {
Fatal error trying to process IPN.
Exit (0);
}
------Solution--------------------
You this ipn.php file is the Verify page to pay for success? I have an SQL statement that sees your update payment status.
If I'm right, then you have to make it clear that the customer pays the process is to go to the browser, so the cookie header can be continued, but PayPal request you this page to advertise your payment results This process is done through the Palpay server, such as our PHP commonly used curl. So if you do not explicitly pass the current cookie to PayPal, then the PayPal request header with this cookie, how can read to the session.