Help with PP IPN Script - it quit working - give me your quotes please
I am very frustrated at the moment and need help with my IPN script.
It used to work without any problems but now doesn't seem to work the way it should any more.
Orders are going through without any problems but the script doesn't send emails anymore and does not post the entries into my database. Here is the script if you have any idea on how to solve this let me know I'm willing to pay for this.
Script:
<?php $datHost = "localhost"; $datName = "*****"; $datUser = "*****"; $datPass = "*****"; $datBase = mysql_connect($datHost, $datUser, $datPass); mysql_select_db($datName, $datBase); //------------------------------------------------ // Read post from PayPal system and create reply // starting with: 'cmd=_notify-validate'... // then repeating all values sent - VALIDATION. //------------------------------------------------ $postvars = array(); while (list ($key, $value) = each ($HTTP_POST_VARS)) { $postvars[] = $key; } $req = 'cmd=_notify-validate'; for ($var = 0; $var < count ($postvars); $var++) { $postvar_key = $postvars[$var]; $postvar_value = $$postvars[$var]; $req .= "&" . $postvar_key . "=" . urlencode ($postvar_value); } //-------------------------------------------- // Create message to post back to PayPal... // Open a socket to the PayPal server... //-------------------------------------------- $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.paypal.com", 80, $errno, $errstr, 30); //---------------------------------------------------------------------- // Check HTTP connection made to PayPal OK, If not, print an error msg //---------------------------------------------------------------------- if (!$fp) { $res = "FAILED"; } else { fputs ($fp, $header . $req); while (!feof($fp)) { $res = fgets ($fp, 1024); if (strcmp ($res, "VERIFIED") == 0) { if (strcmp($tpayment_status, "Refunded") == 0) { $parent_txn_id = "REFUNDED|".$parent_txn_id; $sql = "UPDATE pp_Payments SET payment_id = '$parent_txn_id' WHERE payer_email = '$payer_email'"; mysql_query($sql,$datBase); } if (strcmp($tpayment_status, "Reversed") == 0) { $parent_txn_id = "REVERSED|".$parent_txn_id; $sql = "UPDATE pp_Payments SET payment_id = '$parent_txn_id' WHERE payer_email = '$payer_email'"; mysql_query($sql,$datBase); } if (strcmp ($payment_status, "Completed") == 0 || strcmp($txn_type, "subscr_signup") == 0 || strcmp($txn_type, "subscr_cancel") == 0) { if (strcmp($txn_type, "subscr_payment") != 0 && strcmp($txn_type, "subscr_cancel") != 0) { $strIPaddress = $_SERVER['REMOTE_ADDR']; $fecha = strtotime($payment_date); $Date = date('Y-m-d',$fecha); if(strcmp($txn_type, "subscr_signup") == 0) { $txn_id = $subscr_id; $mc_gross = '0.00'; $mc_fee = '0.00'; } $sql = "INSERT into pp_Payments ( item_name, item_number, mc_gross, mc_fee, first_name, last_name, payer_email, payment_date, payment_id, ip_address, AFF_ID ) VALUES ( '$item_name', '$item_number', '$mc_gross', '$mc_fee', '$first_name', '$last_name', '$payer_email', '$Date', '$txn_id', '$strIPaddress', '$custom' ) "; mysql_query($sql,$datBase); $strSubject = "Discover The Divine Truth eBook"; $strBody .= "Dear ".$first_name." ".$last_name.",\n\n"; $strBody .= "Thank you for your purchase of Discover The Divine Truth eBook! You may download the ebook including the bonus from the link below:\n\n"; $strBody .= "http://www.discoverthedivinetruth.com/DownLoad.php?KEYS=".$txn_id."\n\n"; $strBody .= "All the Best,\n\n"; $strBody .= "Tino Hartung"; mail($payer_email, $strSubject, $strBody, "From: webhomez@web.de", "-fwebhomez@web.de"); } if (strcmp($txn_type, "subscr_cancel") == 0) { $subscr_id = "CANCELLED|".$subscr_id; $sql = "UPDATE pp_Payments SET payment_id = '$subscr_id' WHERE payer_email = '$payer_email'"; mysql_query($sql,$datBase); } } } } } //------------------------------------------- // Close PayPal Connection, Log File and DB. //------------------------------------------- fclose ($fp); mysql_close($db); ?>
I'm not sure if that is the problem, however it could be. My problem though is which variables to change that it will work again???
Please let me know if you have the solution and if you need money and more data to solve this let me know how much and what you need.
Thanks a lot
Tino
Roger Willcocks
L-Space Design
Please vote to help me win a 3kW solar array
Roger Willcocks
L-Space Design
Please vote to help me win a 3kW solar array