请问各位大大 paypal是不是更新了 我的程式在结帐后出现错误 以下 为程式码 希望高手为小弟解惑 感恩:)
错误为Warning: file_put_contents(/tmp/paypal-log) [function.file-put-contents]: failed to open stream: No such file or directory in C:\wamp\www\New Carxplore\dealer_payment_details.php on line 42Warning: file_put_contents(/tmp/paypal-log) [function.file-put-contents]: failed to open stream: No such file or directory in C:\wamp\www\New Carxplore\dealer_payment_details.php on line 50Warning: file_put_contents(/tmp/paypal-log) [function.file-put-contents]: failed to open stream: No such file or directory in C:\wamp\www\New Carxplore\dealer_payment_details.php on line 50----------------------------------------------------------------------
程式码为<?php        $merchant_id  = "[email protected]";               
        $currency_code = "AUD";        // read the post from PayPal system and add 'cmd'
        $req = 'cmd=_notify-validate';
        foreach ($_POST as $key => $value)
        {
            $value = urlencode(stripslashes($value));
             $req .= "&$key=$value";
        }        // post back to PayPal system to validate
        $header .= "POST /cgi-bin/webscr HTTP/1.0\r\n";
        $header .= "Content-Type: application/x-www-form-urlencoded\r\n";
        $header .= "Content-Length: " . strlen($req) ."\r\n\r\n";
        $fp = fsockopen ('www.sandbox.paypal.com', 80, $errno, $errstr, 30);        // assign posted variables to local variables
         $item_name = $_POST['item_name'];
 $item_number = $_POST['item_number'];
         $payment_status = $_POST['payment_status'];
         $payment_amount = $_POST['mc_gross'];
         $payment_currency = $_POST['mc_currency'];
         $txn_id = $_POST['txn_id'];
         $receiver_email = $_POST['receiver_email'];
         $payer_email = $_POST['payer_email'];
 $user_id = $_SESSION['login_id'];
        if (!$fp)
        {
            fclose($fp);
            return false;
        }
        else
        {
            fputs($fp, $header . $req);
            
            // debug log
            file_put_contents('/tmp/paypal-log', date('Y-m-d H:i:s') . $header . $req . "\n", FILE_APPEND);
            
            
            while (!feof($fp))
            {
               $res = fgets($fp, 1024);
                
                // debug log
                file_put_contents('/tmp/paypal-log', date('Y-m-d H:i:s') . $res . "\n", FILE_APPEND);
                
                
                if (strcmp($res, "VERIFIED") == 0)
                {
                    // check the payment_status is Completed
                    if ($payment_status == "Completed")
                    { $payment_id=mysql_num_rows(mysql_query("SELECT * from seller_payment"));
$payment_id++; $date = date('Y-m-d');
$time = date("H:i:s"); $query_payment="INSERT INTO seller_payment
VALUES(
'$payment_id',
'$user_id',
'$txn_id',
'$item_name',
'$payment_amount',
'0',
'$payment_amount',
'$date',
'$time'
)";

mysql_query($query_payment);
echo mysql_error(); $total_grade_record ="SELECT * FROM grade_record";
$grade_record_id=mysql_num_rows(mysql_query($total_grade_record));
$grade_record_id++; if ($item_name=="$99.90 Dealership Package (Monthly)"){
$car_amount = "100";
}elseif ($item_name=="$139.90 Dealership Package (Monthly)"){
$car_amount = "200";
}

$newdate = date("Y-m-d", strtotime ("$date +1 months"));  $query_grade_record="INSERT INTO grade_record VALUES('$grade_record_id','$user_id','$item_name','$car_amount','$date','$newdate')";
mysql_query($query_grade_record);
echo mysql_error(); $update_function="UPDATE seller SET status = 'on' where id='$user_id'";
mysql_query($update_function);
echo mysql_error();
?>
<br><br>
<table width="370" border="0" cellspacing="0" cellpadding="0">
<tr valign="center">
<td width="70" align="right">
<img src="images/bidwin.gif">
</td>
<td width="300" align="right" class="page_title" style="font-size:24px;">
<?php echo $lang['sign_up_dealer_done_note2'];  ?><br>
<span style="font-size:12px;color:#597917;font-family:arial;"><?php echo $lang['sign_up_dealer_done_note3'];  ?></span>
</td>
</tr>
<tr>
<td colspan="2" align="center">
<br>
<br>
<br>
<br>
<input type="button" name="account" id="account" value="<?php echo $lang['sign_up_dealer_done_print_receipt_btn']; ?>" class="btn" onclick="javascript:window.location.href=''">
&nbsp;&nbsp;&nbsp;
<input type="button" name="account" id="account" value="<?php echo $lang['sign_up_dealer_done_account_btn']; ?>" class="btn" onclick="javascript:window.location.href='dealer_panel.php'">
&nbsp;&nbsp;&nbsp;
<input type="button" name="account" id="account" value="<?php echo $lang['sign_up_dealer_done_history_btn']; ?>" class="btn" onclick="javascript:window.location.href=''">
</td>
</tr>
</table><?php }else{

                        fclose($fp);
                        return false;                    }                }
                elseif (strcmp($res, "INVALID") == 0)
                {
                    // log for manual investigation
                    fclose($fp);
                    return false;
                }
            }
        }?>------------------------------------------------------------------------------------------------------------

解决方案 »

  1.   

    /tmp/paypal-log看一下这个文件夹是不是不能写入文件了。提示的很清楚了。
      

  2.   

    在 tmp下手动创建一个 paypal-log 文件这个错误应该是 tmp 没有 paypal-log  文件  所以 file_put_contents 也就无法打开写入
      

  3.   

    试过了 不行哦把这句 
    file_put_contents('/tmp/paypal-log', date('Y-m-d H:i:s') . $header . $req . "\n", FILE_APPEND);去掉再echo $res = fgets($fp, 1024);
    变成invalid之前弄还好好的。怎么过了个月就不能了请问有高手为我解答吗~