嘿,我想问你一个特定的脚本,这里是:
我明白了一切,它的结构非常好,我真的很喜欢它,我看起来也很安全,但我对这个 else-part 有一个问题:
} else {
// PayPal payment is valid
// Process order here
}
我必须在这里做什么?在数据库中插入值??但这是以前做过的吗?!:
} else {
// Transaction not processed, store it in the database
$payer_email = mysql_real_escape_string($_POST[‘payer_email’]);
$gross = mysql_real_escape_string($_POST[‘mc_gross’]);
问候 !
编辑:好的,我也可以用这个来防止重放攻击吗?:
if($f[‘count’] > 0) {
$errors[] = “Transaction already processed”;
} else {
if (count($errors) > 0) {
// IPN data is incorrect - possible fraud
// It is a good practice to send the transaction details to your e-mail and investigate manually
$message = "IPN failed fraud checks";
mail(‘youremail@example.com’, 'IPN Fraud Warning', $message, $headers);
} else {
// Transaction not processed, store it in the database
$payer_email = mysql_real_escape_string($_POST[‘payer_email’]);
$gross = mysql_real_escape_string($_POST[‘mc_gross’]);
$insert = mysql_query(“INSERT INTO transactions (txt_id, payer_email, mc_gross) VALUES
(‘$txt_id’,’$payer_email’,’$mc_gross’)”);
}
}
你觉得这怎么样?