Twango Posted September 13, 2011 Share Posted September 13, 2011 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! Link to comment Share on other sites More sharing options...
justsomeguy Posted September 13, 2011 Share Posted September 13, 2011 It is PayPal that contacts your server, not the user. You can't use the session, you're using a session for the PayPal server instead of the user. You should be able to pass values to PayPal that it will pass back. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.