Donations:

- Do not limit donations to integer amounts;
- Use PayPal with https;
- (Hopefully) fix PayPal Instant Payment Notification.

svn path=/trunk/boinc/; revision=12789
This commit is contained in:
Rytis Slatkevičius 2007-05-31 11:14:49 +00:00
parent 65098dae85
commit 9a5d664d59
2 changed files with 5 additions and 7 deletions

View File

@ -8,7 +8,7 @@ db_init();
$logged_in_user = get_logged_in_user(false);
$amount = post_int("inV");
$amount = post_str("inV");
$item_id = post_int("item_id", true);
if ($item_id == null) { $item_id = 1; }
$currency = post_str("currency");
@ -21,8 +21,7 @@ if ((post_int("anonymous", true) == 1) || ($logged_in_user == null)) {
$order_time = time();
// Write user id to paypal table, so the return script knows it's expecting this payment
$sql = "INSERT INTO donation_paypal SET order_time = '".$order_time."', userid = '$userid', item_number=".$item_id.", order_amount = '$amount'";
mysql_query($sql);
mysql_query("INSERT INTO donation_paypal SET order_time = '".$order_time."', userid = '$userid', item_number=".$item_id.", order_amount = '".mysql_real_escape_string($amount)."'");
$payment_id = mysql_insert_id();
@ -30,8 +29,8 @@ $URL = "www.paypal.com/cgi-bin/webscr";
$fields = ("cmd=_xclick&lc=US&business=".PAYPAL_ADDRESS."&quantity=1&item_name=Donation&item_number=".$payment_id."_".$order_time."&amount=".$amount."&no_shipping=1&return=".URL_BASE."donated.php&rm=2&cancel_return=".URL_BASE."donated.php&no_note=1&currency_code=".$currency."&bn=PP-BuyNowBF");
header("Location: http://$URL?$fields");
header("Location: https://$URL?$fields");
exit;
?>
?>

View File

@ -41,8 +41,7 @@ if (!$fp) {
$item_array = explode("_",$item_number);
$payment_id = abs($item_array[0]);
$order_time = abs($item_array[1]);
$sql = "SELECT * FROM donation_paypal WHERE order_time = '$order_time' AND id = '$payment_id' AND processed = '0'";
$result = mysql_query($sql,$db);
$result = mysql_query("SELECT * FROM donation_paypal WHERE order_time = '$order_time' AND id = '$payment_id' AND processed = '0'");
$num_rows = mysql_num_rows($result);
if ($num_rows == 1) {
$row = mysql_fetch_object($result);