Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/283.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 贝宝ipn错误的结果,为什么?_Php_Paypal_Paypal Ipn - Fatal编程技术网

Php 贝宝ipn错误的结果,为什么?

Php 贝宝ipn错误的结果,为什么?,php,paypal,paypal-ipn,Php,Paypal,Paypal Ipn,嘿,我创建了这个脚本: // Check to see there are posted variables coming into the script if ($_SERVER['REQUEST_METHOD'] != "POST") die ("No Post Variables"); // Initialize the $req variable and add CMD key value pair $req = 'cmd=_notify-validate'; // Read the p

嘿,我创建了这个脚本:

// Check to see there are posted variables coming into the script
if ($_SERVER['REQUEST_METHOD'] != "POST") die ("No Post Variables");
// Initialize the $req variable and add CMD key value pair
$req = 'cmd=_notify-validate';
// Read the post from PayPal
foreach ($_POST as $key => $value) {
    $value = urlencode(stripslashes($value));
    $req .= "&$key=$value";
}
// Now Post all of that back to PayPal's server using curl, and validate everything with PayPal
// Use CURL instead of PHP for this for a more universally operable script (not fsockopen)
//$url = "https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_notify-validate;
$url = "https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_notify-validate";
$curl_result=$curl_err='';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $req);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/x-www-form-urlencoded", "Content-Length: " . strlen($req)));
curl_setopt($ch, CURLOPT_HEADER , 0);   
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
$curl_result = @curl_exec($ch);
$curl_err = curl_error($ch);
curl_close($ch);

$req = str_replace("&", "\n", $req);  // Make it a nice list => Possibility to email it to yourselve for reporting

// Check that the result verifies
if (strpos($curl_result, "VERIFIED") !== false) {
    $req .= "\n\nPaypal Verified OK";
} else {
$req .= "\n\nData NOT verified from Paypal!";
mail("me@myemail.de", "IPN interaction not verified", "$req", "From: me@myemail.de" );
exit();
}                                      

/* CHECK THESE 4 THINGS BEFORE PROCESSING THE TRANSACTION, HANDLE THEM AS YOU WISH
1. Make sure that business email returned is your business email
2. Make sure that the transaction’s payment status is “completed”
3. Make sure there are no duplicate txn_id
4. Make sure the payment amount matches what you charge for items. (Defeat Price-Jacking) */

// Connect to database ------------------------------------------------------------------------------------------------------- 
define('SECURE', true);
require_once 'connect_to_mysql.php';
    $errors = array();
    // PAYMENT VALID

    // Check payment status 
    if ($_POST['payment_status'] != 'Completed') { 
        $errors[] .= "Payment not completed";

    }

    // Check seller e-mail
    if ($_POST['receiver_email'] != 'email@gmx.de')  {
        $errors[] .= "Incorrect seller e-mail";
    }

    // Compare the amount received on PayPal with the price you charged for the product or service
    if ($_POST['mc_gross'] != '100.00') {
        $errors[] .= "Incorrect product price";
    }

    // Check the currency code
    if ($_POST['mc_currency'] != 'USD')  {
        $errors[] .= "Incorrect currency code";
    }

    // Check transaction id
    $txn_id = mysqli_real_escape_string($_POST['txn_id']);

    $sql = "SELECT COUNT(*) AS count FROM `transactions` WHERE `txn_id` = $txn_id";
    $q = mysqli_query($mysqli, $sql);
    $f = mysqli_fetch_array($q);

    if($f['count'] > 0) {
        $errors[] .= “Transaction already processed”;

    } else {
        // Transaction not processed, store it in the database
        $payer_email  = mysqli_real_escape_string($_POST['payer_email']);
        $mc_gross = mysqli_real_escape_string($_POST['mc_gross']);

        $insert = mysqli_query($mysqli, “INSERT INTO transactions (`txn_id`, `payer_email`,`mc_gross`) 
                                                           VALUES ($txn_id,$payer_email,$mc_gross)”);
    }

    if (count($errors) > 0)  {

        $ftp_pfad = "http://www.example.eu.pn";
        $folder = "transactions";
        $subfolder = "Ordner"; 
        $pathBase1 = $ftp_pfad.'/'.$folder;
        $pathBase2 = $ftp_pfad.'/'.$folder.'/'.$subfolder;  
        mkdir("/srv/disk8/1391019/www/example.eu.pn/$folder", 0755);

    } else {

        $ftp_pfad = "http://www.example.eu.pn";
        $folder = "transactions";
        $subfolder = "Ordner"; 
        $pathBase1 = $ftp_pfad.'/'.$folder;
        $pathBase2 = $ftp_pfad.'/'.$folder.'/'.$subfolder;  
        mkdir("/srv/disk8/1391019/www/example.eu.pn/$folder", 0755);
        // PayPal payment is valid
        // Process order here

    }
mysqli_close($mysqli);

当我查看我的沙箱账户时,钱已经寄出去了,但我不得不接受它,为什么?而且,函数“mkdir”不起作用,有人能帮我吗?我在我的沙箱帐户中做了所有设置,但我仍然必须接受收到的钱

您运行php的用户是否有权限在那里
mkdir
呢?嗯,我将权限设置为“0755”,所以是的,嗯..不,只有在您已经有权限的情况下才设置权限。如果php没有开始的权限,那么0755就没有任何意义。