Session failure, very strange failure solution

Source: Internet
Author: User
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-&GT;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-&GT;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.
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.