mokle94
Huh
Hi there, i was wondering if you could help me.
I'm using ubuntu 11.04, and and i'm about to host a server but i've got a problem with paypal.
Everything's going well until the part where the account has to get points. It doesn't.
I enabled IPN like http://example.info/paypal/ipn/ipn.php
ipn.php
paypal.htm
I'm using ubuntu 11.04, and and i'm about to host a server but i've got a problem with paypal.
Everything's going well until the part where the account has to get points. It doesn't.
I enabled IPN like http://example.info/paypal/ipn/ipn.php
ipn.php
Lua:
<?php
if ($_REQUEST['debug']) {
ini_set("display_errors", True);
error_reporting(E_ALL);
}
$mysql_host = 'localhost'; //Leave at localhost
$mysql_user = '~'; //DB User
$mysql_pass = '~'; //DB Pass
$mysql_db = '~'; //DB Name
$file = 'paypal.log'; //Paypal Log Name will be placed in the same location as your ipn.php file
$payer_email = $_REQUEST['payer_email'];
$ip = $_SERVER['REMOTE_ADDR'];
$ips = array('66.211.170.66', '216.113.188.202', '216.113.188.203', '216.113.188.204', '216.113.188.205', '66.135.197.163', '66.135.197.164', ' 66.135.197.162', '66.135.197.141', '216.113.191.33');
if(!in_array($ip, $ips)) {
print "Scammer...";
$hak = fopen("scammer.log", "a");
fwrite($hak, "$ip \r\n");
fclose($hak);
die(0);
}
$time = date("F j, Y, g:i a");
$paylist = array("2.00" => 5, "4.00" => 10,"8.00" => 20, "12.00" => 30);
// connect db
$db = mysql_connect($mysql_host, $mysql_user, $mysql_pass);
$custom = stripslashes(ucwords(strtolower(trim($_REQUEST['custom']))));
$receiver_email = $_REQUEST['receiver_email'];
$payment_status = $_REQUEST['payment_status'];
$mc_gross = $_REQUEST['mc_gross'];
$mc_currency = $_REQUEST['mc_currency'];
mysql_select_db($mysql_db, $db);
if ($_REQUEST['debug']){
print $payment_status . '\n';
print (isset($paylist[$mc_gross])) ? 1 : 0 . '\n';
print $receiver_email . '\n';
print $custom . '\n';
}
if ($payment_status == "Completed" && $receiver_email == "[email protected]" && isset($paylist[$mc_gross]) && $mc_currency == "EUR") {
$somecode = "'$time' '$custom' '$payer_email' '$mc_gross' '$ip'\r\n";
$qry2 = "UPDATE `accounts` SET `premium_points` = `premium_points` + {$paylist[$mc_gross]} WHERE `name` = '$custom'";
// Log Paypal Transaction
$hak = fopen($file, "a");
fwrite($hak, $somecode);
fclose($hak);
$result2 = mysql_query($qry2);
}
else
{
echo("Error.");
}
?>
paypal.htm
Lua:
<blockquote>
<img src="http://inchoo.net/wp-content/uploads/2011/03/paypal.jpg" alt="" width="300" height="100" /></p>
<b>PayPal Donation System.</b><br><br>
<br>
<b><i><font face="Verdana" size="1" color="red">S</font></i></b><i><b><font size="1" face="Verdana" color="red">ome
of the conversions for those who want to calculate:<br>
* 1 EUR = 1.243 USD (US Dollar)<br>
* 1 EUR = 1.294 CAD (Canadian Dollar)<br>
* 1 EUR = 1.955 BAM (Bosnian Convertible Mark)<br>
* 1 EUR = 0.80 GBP (British Pound)</font></b></i><br>
<br>
<b>Here are the steps you need to follow in order to make a donation:</b> <br>
1. Have a PayPal account with required balance or a creditcard. <br>
2. Fill in your account name. <br>
3. Click on the <u><font color="#red">Buy Now</font></u> button or your creditcard brand. <br>
4. Make a transaction. <br>
5. After the transaction points will be automatically added to your account. <br> <br> </b>
<span style="color:red">We reserve the right to terminate all gifts (otherwise
the whole account) if the donated money is charged back. (recalled)</span>
</blockquote>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="[email protected]">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="item_name" value="Sotania Points">
<b>Account name/login:</b> <input type="text" name="custom" value="" size="20">
<select name="amount">
<option value="2.00">2 EUR</option>
<option value="4.00">4 EUR</option>
<option value="8.00">8 EUR</option>
<option value="12.00">12 EUR</option>
</select>
<input type="hidden" name="button_subtype" value="products">
<input type="hidden" name="currency_code" value="EUR">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="currency_code" value="EUR">
<input type="hidden" name="notify_url" value="http://example/paypal/ipn/ipn.php">
<input type="hidden" name="return" value="http://example">
<input type="hidden" name="rm" value="0">
<input type="hidden" name="bn" value="PP-BuyNowBF:btn_buynowCC_LG.gif:NonHostedGuest">
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!" width="147" height="47">
<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>