cody4camp Posted May 1, 2009 Share Posted May 1, 2009 how do callbacks work, like : http://www.pimp-battle.com/ipn.php?snuid=1¤cy=200 i want that to add credits to a user would it be like $id = $_POST['snuid'];??? i want it to modify my variable from the callback ping. i want $id to equal snuid and $turns to equal currency Quote Link to comment https://forums.phpfreaks.com/topic/156428-solved-callbacks-help/ Share on other sites More sharing options...
Maq Posted May 1, 2009 Share Posted May 1, 2009 You should use $_GET. $id = $_GET['snuid']; $turns = $_GET['currency']; i want it to modify my variable from the callback ping. Not sure what this exactly means. Quote Link to comment https://forums.phpfreaks.com/topic/156428-solved-callbacks-help/#findComment-823617 Share on other sites More sharing options...
cody4camp Posted May 1, 2009 Author Share Posted May 1, 2009 ok heres what i want it to do, say the server calls back: http://www.pimp-battle.com/offerpal.php?snuid=1¤cy=100 i want $id to equal snuid and $turns to equal currency, you solved that, but now i cant get it to actually add the credits. will this work: $id = $_GET['snuid']; $turns = $_GET['currency']; if{$turns > 5{ $expires=$time+7776000; //update database to add turns to user in game they bought for // pinoywebdev add s $expires = cln($expires); $turns = cln($turns); $custom = cln($custom); $refcredit = cln($refcredit); // pinoywebdev add e mysql_query("UPDATE $tab[user] SET status='supporter', statusexpire='$expires', credits=credits+$turns WHERE id='$id'"); } Quote Link to comment https://forums.phpfreaks.com/topic/156428-solved-callbacks-help/#findComment-823630 Share on other sites More sharing options...
cody4camp Posted May 1, 2009 Author Share Posted May 1, 2009 heres my full code, but still wont work: <? include("functions.php"); $id = $_GET['snuid']; $turns = $_GET['currency']; if($turns > 0){ $expires=$time+7776000; //update database to add turns to user in game they bought for $expires = cln($expires); $turns = cln($turns); $id = cln($id); mysql_query("UPDATE $tab[user] SET status='supporter', statusexpire='$expires', credits=credits+$turns WHERE id='$id'"); } fclose ($fp); ?> Quote Link to comment https://forums.phpfreaks.com/topic/156428-solved-callbacks-help/#findComment-823639 Share on other sites More sharing options...
Maq Posted May 1, 2009 Share Posted May 1, 2009 heres my full code, but still wont work: OK, well the GET method is correct as long as the URL is what you posted. Why happens? What tells you it does work? Something doesn't happen, something does happen that's not supposed to? Any Errors? What's the clr() function look like? Are you echoing out testing strings so you know what part got executed? Maybe it's your query? Put or die(mysql_error()) at the end. Maybe it's a syntax error, put this directly after you opening <?php tag: ini_set ("display_errors", "1"); error_reporting(E_ALL); Quote Link to comment https://forums.phpfreaks.com/topic/156428-solved-callbacks-help/#findComment-823644 Share on other sites More sharing options...
Ken2k7 Posted May 1, 2009 Share Posted May 1, 2009 What's $tab[user]? What's function clr? Quote Link to comment https://forums.phpfreaks.com/topic/156428-solved-callbacks-help/#findComment-823645 Share on other sites More sharing options...
cody4camp Posted May 1, 2009 Author Share Posted May 1, 2009 What i am doing is implementing offerpal into my BBG offerpal sends callbacks to my server when an offer got completed and credits the user with their credits. when i test it it says this: Test We have just test fired a simulated transaction, please verify you got it and credited the currency to your end-users correctly: Test was successful : HTTP return code (200) http://www.pimp-battle.com/offerpal.php?snuid=29¤cy=100 but it did not credit the currency. Quote Link to comment https://forums.phpfreaks.com/topic/156428-solved-callbacks-help/#findComment-823650 Share on other sites More sharing options...
Maq Posted May 1, 2009 Share Posted May 1, 2009 First echo something after your IF statement to see if it's even being executed. If it is, then there's probably something wrong with your query, change it to: $sql = "UPDATE $tab[user] SET status='supporter', statusexpire='$expires', credits=credits+$turns WHERE id='$id'"; echo "QUERY=> " . $sql; mysql_query($sql) or die(mysql_error()); and post what the output is. EDIT: Put query in string, echoed it, then executed the query. Quote Link to comment https://forums.phpfreaks.com/topic/156428-solved-callbacks-help/#findComment-823654 Share on other sites More sharing options...
cody4camp Posted May 1, 2009 Author Share Posted May 1, 2009 new coder: <? ini_set ("display_errors", "1"); error_reporting(E_ALL); include("functions.php"); $id = $_GET['snuid']; $turns = $_GET['currency']; if($turns > 0){ //update database to add turns to user in game they bought for mysql_query("UPDATE $tab[user] SET status='supporter', credits=credits+$turns WHERE id='$id'"); } fclose ($fp); ?> still dont work, maybe its my if statement? Quote Link to comment https://forums.phpfreaks.com/topic/156428-solved-callbacks-help/#findComment-823656 Share on other sites More sharing options...
cody4camp Posted May 1, 2009 Author Share Posted May 1, 2009 error Notice: Undefined variable: tab in /home/cody4cam/public_html/offerpal.php on line 13 Warning: mysql_query() [function.mysql-query]: Access denied for user 'cody4cam'@'localhost' (using password: NO) in /home/cody4cam/public_html/offerpal.php on line 13 Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /home/cody4cam/public_html/offerpal.php on line 13 Access denied for user 'cody4cam'@'localhost' (using password: NO) Quote Link to comment https://forums.phpfreaks.com/topic/156428-solved-callbacks-help/#findComment-823659 Share on other sites More sharing options...
revraz Posted May 1, 2009 Share Posted May 1, 2009 Does your functions.php hold your connect info? Looks like your ID doesn't have the correct rights. Quote Link to comment https://forums.phpfreaks.com/topic/156428-solved-callbacks-help/#findComment-823663 Share on other sites More sharing options...
cody4camp Posted May 1, 2009 Author Share Posted May 1, 2009 ive edited alot, now i only got this error: QUERY=> UPDATE 'user' SET credits=credits+200 WHERE id='29'You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''user' SET credits=credits+200 WHERE id='29'' at line 1 Quote Link to comment https://forums.phpfreaks.com/topic/156428-solved-callbacks-help/#findComment-823665 Share on other sites More sharing options...
revraz Posted May 1, 2009 Share Posted May 1, 2009 Remove the single quotes around user. Quote Link to comment https://forums.phpfreaks.com/topic/156428-solved-callbacks-help/#findComment-823667 Share on other sites More sharing options...
cody4camp Posted May 1, 2009 Author Share Posted May 1, 2009 well actually i got the table wrong its users. SOLVED, thanx to Maq and revraz Quote Link to comment https://forums.phpfreaks.com/topic/156428-solved-callbacks-help/#findComment-823670 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.