0

I have problem to get the IPN from PayPal.

This is the server log error:

[22-Aug-2013 19:45:34 Asia/Jerusalem] PHP Warning: mysql_query() [function.mysql-query]: Access denied for user 'reshopco'@'localhost' (using password: NO) in /home/reshopco/public_html/8813/paypal3.php on line 61

[22-Aug-2013 19:45:34 Asia/Jerusalem] PHP Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /home/reshopco/public_html/8813/paypal3.php on line 61

Is there a problem with the code or possibly a problem in our server?

This is the code that I got from the PayPal example:

  <?
// 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 .= "Host: www.paypal.com\r\n";
$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
$header .= "Content-Length: " . strlen($req) . "\r\n\r\n";
$header .= "Connection: close\r\n\r\n";

$fp = fsockopen ('www.paypal.com', 80, $errno, $errstr, 30);


$payment_status = $_POST['payment_status'];
$custom =  $_POST["custom"];
$txn_type = $_POST["txn_type"];

// YOU CAN ALSO RETRIEVE ADDITIONAL FIELDS SUCH AS:

// $payment_currency = $_POST['mc_currency'];
// $txn_id = $_POST['txn_id'];
// $receiver_email = $_POST['receiver_email'];
// $payer_email = $_POST['payer_email'];
// $invoice = $_POST['invoice'];
 
// $firstName = $_POST["first_name"];
// $lastName = $_POST["last_name"];
// $street = $_POST["address_street"];
// $city = $_POST["address_city"];
// $pcode = $_POST["address_zip"];
// $county = $_POST["address_state"];
// $country = $_POST["address_country"];

 
if (!$fp) 
{
echo "HTTP ERROR";
} 
else 
{ // start 1
fputs ($fp, $header . $req);
while (!feof($fp)) 
 { // start 2
 $res = fgets ($fp, 1024);
  if (strcmp ($res, "VERIFIED") == 0) 
  { // start 3

// ONLY DO THE PROCESSING IF THE STATIS IS COMPLETED (REFUNDS ALSO HIT THE IPN)
if ($payment_status == "Completed")
{ // start 4

// IF THE PAYMENT HAS BEEN MADE UPDATE OUR OIRDERS TABLE
// WE PASSED OUR ORDER NUMBER TO PAYPAL IN THE custom FIELD AND USE THIS TO UPDATE THE CORRECT ORDER    
$sql = "Update orderstaable set processed = 0, paymentmethod = 'PAYPAL', orderdate = NOW() where orderid = $custom";
$execute = MYSQL_QUERY($sql);  

// SEND CUSTOMER EMAIL OR WHATEVER  
} // end 4
  } // end 3
     else if (strcmp ($res, "INVALID") == 1) 
     { // start 6
     // log for manual investigation
// email technical support
     } // end 6
 
 } // end 2
fclose ($fp);
}// end 1
?>
4

1 回答 1

0

您在日志中遇到的错误是因为您用于连接 MySQL 数据库的用户/密码组合不正确。

于 2013-08-23T10:08:26.630 回答