php - Paypal payment destroys Session on "Return" -
this question has been asked before. but, still unable find solution.
i have integrated paypal payment website. created , installed "payment button" (the html code), , works perfectly.
the problem, however, : after being re-directed paypal make payment, user's session on website destroyed. meaning : after payment successful (or canceled user, whichever).......the "return url" not work, because user has been logged out.
i did contact paypal, of course; and, expected, next useless (exactly many people here have attested to).
as said earlier, question has been asked before, here :
anybody ever used paypal website payments standard session variables?
the answer proposed "woppi" in thread seemed ok. but, when tried it, did not work. (of course, thread 3 years old).
i don't know else do.
i should point out following, (this makes no difference, want clear possible) :
(a) on website's "log-out page", have set sessions destroyed :
     session_unset();       unset($_session['login']);      unset($_session['password']);       session_destroy();       session_write_close();  as far can see, there nothing wrong code. wipes out , destroys , sessions (which should case, shouldn't it? otherwise, point of logging out? )
(b) not have "cookies" set anywhere (which may part of problem, although not sure). however, have these in html header :
    <meta http-equiv="cache-control" content="no-cache">     <meta http-equiv="pragma" content="no-cache">     <meta http-equiv="expires" content="0"> (c) in old thread (given above), requires value : $session_id;
at beginning of every php page in website, have :
   **<?php session_start();** this has worked far me; did not assign specific id anywhere else.
update
i using cookies in php try resolve problem;
at top of php payment form, have :
  <?php session_start();    if (!(isset($_session['login'])) {    header ("location: /example/access_denied");    exit() ;   }         $cookie_name = "user_paying";   $cookie_value = $_session['login'];   $date_of_expiry = time() + 600 ;    setcookie($cookie_name, $cookie_value, $date_of_expiry, '/', false,true);      (i set cookies expire after 10 minutes);
then, in "return-form" (where user re-directed after making payment in paypal), have @ top :
 <?php session_start();   if (!isset($_cookie['user_paying'])) {  setcookie($cookie_name, $cookie_value, $date_of_expiry, '/', false,true);   }   else {   // etc, etc, etc..........code continues   
 
  
Comments
Post a Comment