Paypal Zahlungsbestätigung
lima-city → Forum → Programmiersprachen → PHP, MySQL & .htaccess
ausgabe
beitrag
email
error
fehler
formen
insert
investigation
kategorie
lead
limit
log
main
message
navigation
preisen
result
shop
whrung
zahlung
-
ich habe folgendes script
<?php // 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"; if($paypal['ssl']=="1"){ $fp = fsockopen ('ssl://www.paypal.com', 443, $errno, $errstr, 30); }else{ $fp = fsockopen ('www.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']; $tid = $_POST['custom']; if (!$fp) { include('config.php'); include('inc/setdefault.php'); $header['subtitel'] = template('header_subtitel_home'); $main['titel'] = template('titel_standard', array('titel' => $cfg['site_titel'])); $main['titel'] .= template('titel_small', array('titel' => ' > ')); $main['titel'] .= template('titel_small', array('titel' => 'Kauf fehlgeschlagen')); $main['content'] = '<span class="f2red">'.$paypal['error'].'</span>'; $site['header'] = template('header', $header); $site['content'] = template('main', $main); $site['navigation'] = template('menu_user', array('online' => counter_online(),'besucher' => counter_besucher(), 'pageviews' => counter_pageviews())); $kategorien['titel'] = template('titel_standard', array('titel' => 'Kategorien')); $kategorien['content']= template('user_menue_kategorien', array('subkategorien' => kategorie_menue($_GET['kat']))); $site['navigation'] .= template('navi', $kategorien); $site['footer'] = template('footer'); print template('site', $site); // HTTP ERROR } else { fputs ($fp, $header . $req); while (!feof($fp)) { $res = fgets ($fp, 1024); if (strcmp ($res, "VERIFIED") == 0) { if ($payment_status == 'Completed') { $row = mysql_fetch_object(mysql_query("SELECT * FROM ".$paypal['tbl']." WHERE tid ='".$tid."' LIMIT 1")); $ausgabe = mysql_query("SELECT * FROM ".$tbl['shop']." WHERE script_id ='".$row->script_id."' LIMIT 1"); $result = mysql_fetch_object($ausgabe); $detail['price'] = $result->script_price; if (count($row->script_id)==1){ header("Content-Type: application/forced-download"); header("Content-Disposition: filename=$result->script_filename"); readfile($cfg['file_path'].$result->script_tmp_filename); mysql_query("UPDATE ".$tbl['shop']." SET script_leads = script_leads + 1 WHERE script_id = '".$row['script_id']."'"); mysql_query("INSERT ".$tbl['leads']." (lead_id, script_id, script_name, user_id, email, waehrung, preis, datetime) VALUES ('0', '".$row->script_id."','".$result->script_name."', '".$row->id."', '".$row->email."', '1', '".$detail['price']."', '".time()."')"); $lead = array( 'script_name' => $result->script_name, 'preis' => $detail['price'], 'user_id' => $row['id'], 'email' => $row['email'] ); $getmail = mailtemplate('mail_lead_info', $lead); $subject = $getmail['subject']; $message = $getmail['message']; $from = "From:".$cfg['site_mail']."\n"; $from .= "Content-Type: text; charset=iso-8859-1"; mail ($cfg['site_mail'],$subject,$message,$from); $getmail = mailtemplate('mail_lead_usermail', $lead); $subject = $getmail['subject']; $message = $getmail['message']; $from = "From:".$cfg['site_mail']."\n"; $from .= "Content-Type: text; charset=iso-8859-1"; mail ($row['email'],$subject,$message,$from); mysql_query("DELETE FROM ".$paypal['tbl']." WHERE tid='".$_GET['tid']."' LIMIT 1"); }else{ echo "Fehler: Zeile 72"; } }else{ echo "Fehler: zahlung nicht erfolgt"; } } else if (strcmp ($res, "INVALID") == 0) { // log for manual investigation echo "Fehler res = INVALID"; } } fclose ($fp); } } ?>
aber ich bekomme immer Fehler res = INVALID gemelded. auf Deutsch Zahlung nicht erfolgt.
jetzt frage ich euch woran liegt das bzw was hab ich Falsch gemacht?
ich vermute das der Fehler irgendwo hier liegt
// 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"; }
mfg
web4me
Beitrag ge?ndert am 14.06.2006 20:04 von web4me
Beitrag ge?ndert am 14.06.2006 20:05 von web4me -
Diskutiere mit und stelle Fragen: Jetzt kostenlos anmelden!
lima-city: Gratis werbefreier Webspace für deine eigene Homepage