有这个paypal页面工作正常,只有当paypal帖子支持它没有插入我的正确值(我的意思是它插入'0'),请看看...
<?php
require 'config.inc.php';
$p = new Paypal();
if(isset($_GET['period']))
{
$allowedPeriods = array("1000", "5000", "10000", "20000");
if(!in_array($_GET['period'], $allowedPeriods))
{
die("Allowed periods are '1000', '5000', '10000', '20000'");
}
if(!$usersClass->checkLoggedIn())
{
die("You must be logged in");
}
$prices = array( "1000" => 10, "5000" => 30, "10000" => 50, "20000" => 85 );
$this_script = "http://".$_SERVER['HTTP_HOST']."/paypal.php?act=";
$p->add_field('business', PAYPAL_EMAIL_ADDRESS);
$p->add_field('return', $this_script.'success');
$p->add_field('cancel_return', $this_script.'cancel');
$p->add_field('notify_url', $this_script.'ipn');
$p->add_field('item_name', 'Credits');
$p->add_field('cmd', '_xclick');
$p->add_field('amount', $prices[$_GET['period']]);
$p->add_field('custom', $usersClass->userID()."||".$_POST['period']);
$p->add_field('rm', '2');
$p->add_field('currency_code','GBP');
$p->submit_paypal_post();
}
if(isset($_GET['act'])) {
switch ($_GET['act']) {
case "cancel": print "Order was canceled!";
break;
case "success":
print "If payment was successfully received you should be on the top!";
break;
case "ipn": if ($p->validate_ipn()) {
$custom = $_POST['custom'];
$explode = explode("||", $custom);
$userid = (int) $explode[0];
$days = $explode[1];
$daysArray = array(10 => 1000, 30 => 5000, 50 => 10000, 85 => 20000 );
$days = $daysArray[$days];
$tillDate = $days;
mysql_query("insert into `featured` values (null, '$userid', '$tillDate')")
}
break;
}
}
?>
答案 0 :(得分:0)
我建议您设置error_reporting(E_ALL)
并自行在ipn脚本上发布帖子进行测试。在0
前面使用FALSE
之前,(int)
也可能意味着{{1}},因此打开所有错误并亲自查看回复至关重要。