Jump to content

Paypal Ipn Session... Thing?


Twango
 Share

Recommended Posts

Ok, I've been working on this for ever, I can't get it to work.I've successfully created an IPN, that once it gets the payment, it does a MySQL query. My problem is, I need to store the username.So the way I did this, is on the page button.html, I have a small Ajax script that submits to addSession.php,addSession.php's source:

 <?phpsession_start();$_SESSION['valus'] = $_REQUEST['uid'];echo "Username currently set to <b>" . $_SESSION['valus'] . "</b>.<br/><br/>";?>

AJAX Code:

<script type="text/javascript">function showHint(){var xmlhttp;var str = document.getElementById('txt1').value;if (str.length==0)  {   }if (window.XMLHttpRequest)  {// code for IE7+, Firefox, Chrome, Opera, Safari  xmlhttp=new XMLHttpRequest();  }else  {// code for IE6, IE5  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");  }xmlhttp.onreadystatechange=function()  {  if (xmlhttp.readyState==4 && xmlhttp.status==200)    {    document.getElementById('txtHint').innerHTML=xmlhttp.responseText;    }  }xmlhttp.open("GET","addSession.php?uid="+str,true);xmlhttp.send();}</script>

and finally, a simple code I used to test to see if the value is set:

<?phpsession_start();$bmx = $_SESSION['valus'];echo $bmx;?>

It returns the session data just fine, but when I submit it to MySQL thru the IPN Auto-Script:

session_start();$bmx = $_SESSION['valus'];mysql_query("INSERT INTO members (descr, usr) VALUES ('Good MTX','$bmx')");

It simply shows up in the database as Good MTX and then blank for usr.Help!

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...