Thanks lothop, can you tell me what you altered on that for future reference please? I have another 2 payment process that on on the game to alter aswell, I’m not home at minute to do it and ain’t had time to have a look through it yet?, thanks though I really do appreciate it
I removed the comment section /* */ for the IPN variables.
I added
$payment_fee = $_POST[‘payment_fee’];
$custom = $_POST[‘custom’];
as I noticed that they were used in the queries lower in the script.
I removed some semicolons from the queries and one set of brackets
Thanks for that, I really appreciate it been a massive help, not the easiest thing to learn but I’m slowly getting there thanks to you guys
Ok so I ran test and still got nothing… Am I right in thinking it could now be the funcs.php so gotta look and check through that right?
Also just to add that payments are being received fine the problem I’m having is the turns being automatically to the buyer and also the jackpot in the game is not updating,how this works for a little insight is when a person donates they receive turns (or should do lol) this in turn puts a % of the donated money in to a jackpot for them to win back at the end of the week ( or should do lol)
Need to start breaking it down and seeing where the errors are coming from.
Remove the paypal section and hardset some variables.
Add a user into your database called ‘testuser’
Refreshing the page should make a payment of $9 ($10 - $fee)
If you are receiving errors from the error_reporting, fix them
[php]<?
error_reporting(E_ALL);
include(“funcs.php”);
$site_Paypal = $site[paypal];
/* // read the post from PayPal system and add 'cmd'
$req = 'cmd=_notify-validate';
foreach ($_POST as $key => $value) {
$value = urlencode(stripslashes($value));
$req .= "&$key=$value";
}
// post back to PayPal system to validate
$header .= "POST /cgi-bin/webscr HTTP/1.0\r\n";
$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
$header .= 'Content-Length: ' . strlen($req) . "\r\n\r\n";
$fp = fsockopen ('www.paypal.com', 80, $errno, $errstr, 30);
// assign posted variables to local variables
// note: additional IPN variables also available -- see IPN documentation
$item_name = $_POST['item_name'];
$receiver_email = $_POST['receiver_email'];
$item_number = $_POST['item_number'];
$invoice = $_POST['invoice'];
$payment_status = $_POST['payment_status'];
$payment_gross = $_POST['payment_gross'];
$txn_id = $_POST['txn_id'];
$payer_email = $_POST['payer_email'];
$payment_fee = $_POST['payment_fee'];
$custom = $_POST['custom'];
if (!$fp) {
// ERROR
echo "$errstr ($errno)";
} else {
fputs ($fp, $header . $req);
while (!feof($fp)) {
$res = fgets ($fp, 1024);
if (strcmp ($res, "VERIFIED") == 0) {
echo "<pre>";
print_r($_POST);
if($payment_status=="Completed") {
*/
$res = "VERIFIED";
$receiver_email = '[email protected]';
$item_number = 1;
$invoice = 123456;
$payment_status = 'VERIFIED';
$payment_gross = 10;
$txn_id = 1;
$payer_email = '[email protected]';
$payment_fee = 1;
$custom = 'testuser';
if (!fetch("SELECT tranid FROM $tab[paypal] WHERE tranid='$txn_id'") && ($business == "$site_Paypal"))
{
//BUG FIX 8.22.09
if($payment_gross < 5){
mysql_query("UPDATE $tab[user] SET status='banned', reason='Attempting money glitch.' WHERE username='$custom'");
}
else{
//BUG FIX 3.9.10
$thecredits = mysql_fetch_array(mysql_query("SELECT res FROM credits_main WHERE id='$item_number'"));
$thecheck = mysql_fetch_array(mysql_query("SELECT res FROM credits_main WHERE cost='$payment_gross'"));
if($thecredits[0]!=$thecheck[0])
{
die();
}
$turns=$thecredits[res];
$crewturns=($thecredits[res]*0.5);
$total=$payment_gross-$payment_fee;
$the_game = mysql_fetch_array(mysql_query("SELECT round FROM $tab[game] WHERE ends>'$time' AND type='publicround'"));
//FELLON-- UPDATE JACKPOT PER ROUND
$thenewpot=($payment_gross-$payment_fee)*.60;
mysql_query("UPDATE $tab[game] SET startjackpot=startjackpot+$thenewpot WHERE round='$the_game[round]'");
$expires=$time+864000;//10 days
$total=$payment_gross-$payment_fee;
//END
mysql_query("UPDATE r$the_game[round]_$tab[pimp] SET res=res+$fulldeal WHERE user='$custom'");
//END
if($fam_res == 'yes'){
//FELLON-- GIVE FAMILY PERCENTAGE
$round_info = mysql_fetch_array(mysql_query("SELECT id,pimp,user,crew FROM r$the_game[round]_$tab[pimp] WHERE user='$custom'"));
if($round_info[crew] != '0'){
mysql_query("UPDATE r$the_game[round]_$tab[pimp] SET res=res+$crewturns WHERE user!='$custom' AND crew='$round_info[crew]'");
//FELLON-- POST TO BOARD
mysql_query("INSERT INTO r$the_game[round]_$tab[board] (time,who,msg,del,board) VALUES ('$time','$round_info[id]','I just purchased credits, and generously everyone in the family each got $crewturns reserves each. Use them wisely!','no','$round_info[crew]')");
mysql_query("UPDATE r$the_game[round]_$tab[pimp] SET cmsg=cmsg+1 WHERE crew='$round_info[crew]'");
mysql_query("UPDATE r$the_game[round]_$tab[pimp] SET res=res+$turns , main_packs=main_packs+1 WHERE main_packs<$main_packs AND user='$custom'");
}
mysql_query("UPDATE $tab[user] SET status='supporter', statusexpire='$expires' WHERE username='$custom'");
//END
}
mysql_query("INSERT INTO $tab[paypal] (tranid,amount,fee,user,datebought,type) VALUES ('$txn_id','$payment_gross','$payment_fee','$custom','$time','$item_number')");
mail_2("A Family Pack Was Bought!","\nDear Admin,\n\nYou just received a payment from $custom for $turns reserves\n\nCost: $$payment_gross\nFee: $$payment_fee\n----------\nTotal: $$total","[email protected]");
}
}else{echo"Cannot refresh transaction!";}
}
// check the payment_status is Completed
// check that txn_id has not been previously processed
// check that receiver_email is an email address in your PayPal account
// process payment
}
else if (strcmp ($res, "INVALID") == 0) {
// log for manual investigation
}
}
//fclose ($fp);
}
?>[/php]