2

ここに問題があります。私はPDTを実行して基本情報を取得し、SQLに投稿しようとしています。さらに重要なことに、カスタム変数も同様です。「lvel」と呼ばれるその整数は、「user_level」および「approved」の下のユーザーに「apv」とも呼ばれますが、手動で「1,2,3..etc」に設定すると値が設定されますが、$ を使用する場合apv または $lvel .. 挿入しません.. 何かアイデアはありますか? 素晴らしいでしょう。警告..試験から非常に面倒..

    <?php
session_start();
$sid = session_id();
include 'dbc.php';
?>
<?php

$pp_hostname = "www.sandbox.paypal.com"; // Change to www.sandbox.paypal.com to test against sandbox


// read the post from PayPal system and add 'cmd'
$req = 'cmd=_notify-synch';

$tx_token = $_GET['tx'];
$auth_token = "_nothing to see here_";
$req .= "&tx=$tx_token&at=$auth_token";

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://$pp_hostname/cgi-bin/webscr");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $req);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
//set cacert.pem verisign certificate path in curl using 'CURLOPT_CAINFO' field here,
//if your server does not bundled with default verisign certificates.
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Host: $pp_hostname"));
$res = curl_exec($ch);
curl_close($ch);

if(!$res){
    //HTTP ERROR
}else{
     // parse the data
    $lines = explode("\n", $res);
    $keyarray = array();
    if (strcmp ($lines[0], "SUCCESS") == 0) {
        for ($i=1; $i<count($lines);$i++){
        list($key,$val) = explode("=", $lines[$i]);
        $keyarray[urldecode($key)] = urldecode($val);
    }
    // check the payment_status is Completed
    // check that txn_id has not been previously processed
    // check that receiver_email is your Primary PayPal email
    // check that payment_amount/payment_currency are correct
    // process payment
    $firstname = $keyarray['first_name'];
    $lastname = $keyarray['last_name'];
    $itemname = $keyarray['item_name'];
    $amount = $keyarray['payment_gross'];

    echo ("<p><h3>Thank you for your purchase!</h3></p>");

    echo ("<b>Payment Details</b><br>\n");
    echo ("<li>Name: $firstname $lastname</li>\n");
    echo ("<li>Item: $itemname</li>\n");
    echo ("<li>Amount: $amount</li>\n");
    //echo ('$sid');
    }
}echo("$amount");
    $apv = '1';
    if($amount == "4.00"){
        $level = '1';
        $sub =1;
    }
    if($amount == "6.00"){
        $lvel = '2';
        $sub =1;
    }
    if($amount == "10.00"){
        $lvel = '3';
        $sub =1;
    }
    if($amount == "14.00"){
        $lvel = '4';
        $sub =1;
    }
    if($amount == "20.00"){
        $lvel = '5';
        $sub =1;
    }
    if($amount == "25.00"){
        $lvel = '6';
        $sub =1;
    }
    if($amount == "30.00"){
        $lvel = '7';
        $sub =1;
    }
    if($amount == "40.00"){
        $lvel = '8';
        $sub =1;
    }
    if($amount == "12.00"){
        $level = '1';
        $sub =2;
    }
    if($amount == "22.00"){
        $lvel = '2';
        $sub =2;
    }
    if($amount == "32.00"){
        $lvel = '3';
        $sub =2;
    }
    if($amount == "42.00"){
        $lvel = '4';
        $sub =2;
    }
    if($amount == "66.00"){
        $lvel = '5';
        $sub =2;
    }
    if($amount == "80.00"){
        $lvel = '6';
        $sub =2;
    }
    if($amount == "95.00"){
        $lvel = '7';
        $sub =2;
    }
    if($amount == "125.00"){
        $lvel = '8';
        $sub =2;
    }




mysql_query("update users set approved='$apv' where sid='$sid'");
mysql_query("update users set user_level='$lvel' where sid='$sid'");

    //else if (strcmp ($lines[0], "FAIL") == 0) {
        // log for manual investigation
   // }




?>
<?php 
$apv1 = '1';
mysql_query("update users set approved='$apv1' where sid='$sid'");
?>
Your transaction has been completed, and a receipt for your purchase has been emailed to you.<br> You may log into your account at <a href='https://www.paypal.com'>www.paypal.com</a> to view details of this transaction.<br>
4

0 に答える 0