Hello , there is my paypal.php and my ipn.php , i tryied using sandbox to test if i get the premium points but im not getting them , DB pass is correct , and that email acc is from sandbox
i can donate with no problem, and then i recive the money on the sandbox acc , i accept the ttranscation, and i dotn get the premmy points on site , i check on the DB too , but there is no points.
any help pleasE?
paypal.php
ipn.php
i can donate with no problem, and then i recive the money on the sandbox acc , i accept the ttranscation, and i dotn get the premmy points on site , i check on the DB too , but there is no points.
any help pleasE?
paypal.php
PHP:
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_donations">
<input type="hidden" name="business" value="[email protected]">
<input type="hidden" name="lc" value="GB">
<input type="hidden" name="item_name" value="Premium Points">
<b>Account number:</b> <input type="text" name="custom" value="">
<input type="hidden" name="item_number" value="1">
<input type="hidden" name="amount" value="10.0">
<input type="hidden" name="currency_code" value="EUR">
<input type="hidden" name="no_note" value="0">
<input type="hidden" name="no_shipping" value="0">
<input type="hidden" name="currency_code" value="EUR">
<input type="hidden" name="notify_url" value="http://localhost/paypal/ipn/ipn.php">
<input type="hidden" name="return" value="http://localhost">
<input type="hidden" name="rm" value="0">
<input type="hidden" name="bn" value="PP-DonationsBF:btn_donateCC_LG_global.gif:NonHosted">
<input type="image" src="http://otland.net/images/paypal_donate_button.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online.">
<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
ipn.php
PHP:
<?
$mysql_host = 'localhost'; //Leave at localhost
$mysql_user = 'root'; //DB User
$mysql_pass = 'XXXXXX'; //DB Pass
$mysql_db = '0.3.6'; //DB Name
$file = 'paypal.log'; //Paypal Log Name will be placed in the same location as your ipn.php file
$custom = stripslashes(ucwords(strtolower(trim($_REQUEST['custom']))));
$receiver_email = $_REQUEST['receiver_email'];
$payment_status = $_REQUEST['payment_status'];
$mc_gross = $_REQUEST['mc_gross'];
$payer_email = $_REQUEST['payer_email'];
$somecode = "'$custom' '$payer_email' '$mc_gross'";
// connect db
$db = mysql_connect($mysql_host, $mysql_user, $mysql_pass);
mysql_select_db($mysql_db, $db);
if ($payment_status == "Completed" & $receiver_email == "[email protected]" & $mc_gross == "##.##") {
$query = "SELECT premium_points FROM accounts WHERE accounts.name = '$custom'";
$result = mysql_query($query);
$prem = mysql_fetch_array($result);
$points = $prem['premium_points'] + 120;
// $points = mysql_query($prem)
$qry2 = "UPDATE accounts SET premium_points = '$points' WHERE accounts.name = '$custom'";
// Log Paypal Transaction
$hak = fopen($file, "a");
fwrite($hak, $somecode);
fclose($hak);
$result2 = mysql_query($qry2);
}
else
{
echo("Error.");
}
?>