麻辣堂|资源主站|开发论坛|在线手册
首页 Apache Linux Java MySQL 注册帮助 
PHP项目开发组是PHP开发资源网于2007组年建成立的项目开发团队,目前核心开发成员有27人, 项目协作成员8名.下设7个开发组,主要承接大/中型网站项目开发任务。

    由于开发任务较多,人员比较紧张,现面向社会招聘全职或者兼职开发人员,不管你是在校大学生,还是全职开发人员,以及SOHO都可以联系本站,我们可以长期合作,并为您带来丰厚的报酬。
  您现在的位置:PHP开发资源网 > 麻辣堂 > 详细资料
待解决
帮忙一起来研究paypal
悬赏分:20 - 2007年08月14日

我还不知道怎么添加按月付款的功能。如何做? 代码: <? ###################################################################### # PHP-NUKE: Web Portal System ###################################################################### # # Copyright (c) 2000 by Francisco Burzi (fbc@mandrakesoft.com) # http://phpnuke.org/ # ###################################################################### # Emporium ###################################################################### # # Copyright (c) 2002 by Michael Squires (msquires@burnwave.com) # http://www.burnwave.com/ || http://www.nukescripts.com # ###################################################################### function cartOrderTableBottom($orderID){ global $prefix, $dbi, $cartconfig; OpenTable(); echo "

Click on the following button to pay through PayPal (Credit Cards Accepted).
"; $result = sql_query("SELECT ppemail, ipn, currency FROM ".$prefix."_cart_payments_options_paypal", $dbi); list($ppemail, $ppipn, $ppcurrency) = sql_fetch_row($result, $dbi); $orderInfo = cartorderinfo($orderID); $item_name = paypal_formgen_format("$cartconfig[companyName] --- Order #$orderID"); $grandTotal = sprintf("%01.2f", $orderInfo[GrandTotal]); echo "\n\n

\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; if($ppipn == 1){ echo "\n"; } echo "\n"; echo "
\n\n"; CloseTable(); } function paypal_formgen_format($string){ $string = ereg_replace('&', '&', $string); $string = ereg_replace('"', '"', $string); $string = ereg_replace('<', '<', $string); $string = ereg_replace('>', '>', $string); return $string; } function formatPaymentString($string){ $string = eregi_replace(";", "%3B", $string); return $string; } function reformatPaymentString($string){ $string = eregi_replace("%3B", ";", $string); return $string; } ################### # PayPal IPN ################### function cartCallback(){ global $prefix, $dbi, $testcode, $HTTP_POST_VARS; if($testcode==1){ die("Success! IPN is set up correctly!"); } $result = sql_query("SELECT ppemail, ipn, currency from ".$prefix."_cart_payments_options_paypal", $dbi); list($ppemail, $ipn, $currency) = sql_fetch_row($result, $dbi); // read the post from PayPal system and add 'cmd' $req = 'cmd=_notify-validate'; foreach ($HTTP_POST_VARS 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.paypal.com', 80, $errno, $errstr, 30); //post back to eliteweaver.co.uk, can be used for testing NSNCart IPN #$header .= "POST /testing/ipntest.php HTTP/1.0\r\n"; #$header .= "Host: www.eliteweaver.co.uk\r\n"; // Host on Shared IP #$header .= "Content-Type: application/x-www-form-urlencoded\r\n"; #$header .= "Content-Length: " . strlen ($req) . "\r\n\r\n"; #$fp = fsockopen ("www.eliteweaver.co.uk", 80, $errno, $errstr, 30); // assign posted variables to local variables // note: additional IPN variables also available -- see IPN documentation $receiver_email = $HTTP_POST_VARS['receiver_email']; $item_name = $HTTP_POST_VARS['item_name']; $item_number = $HTTP_POST_VARS['item_number']; $quantity = $HTTP_POST_VARS['quantity']; $invoice = $HTTP_POST_VARS['invoice']; $custom = $HTTP_POST_VARS['custom']; $option_name1 = $HTTP_POST_VARS['option_name1']; $option_selection1 = $HTTP_POST_VARS['option_selection1']; $option_name2 = $HTTP_POST_VARS['option_name2']; $option_selection2 = $HTTP_POST_VARS['option_selection2']; $num_cart_items = $HTTP_POST_VARS['num_cart_items']; $payment_status = $HTTP_POST_VARS['payment_status']; $pending_reason = $HTTP_POST_VARS['pending_reason']; $payment_date = $HTTP_POST_VARS['payment_date']; $settle_amount = $HTTP_POST_VARS['settle_amount']; $settle_currency = $HTTP_POST_VARS['settle_currency']; $exchange_rate = $HTTP_POST_VARS['exchange_rate']; $payment_gross = $HTTP_POST_VARS['payment_gross']; $payment_fee = $HTTP_POST_VARS['payment_fee']; $mc_gross = $HTTP_POST_VARS['mc_gross']; $mc_fee = $HTTP_POST_VARS['mc_fee']; $mc_currency = $HTTP_POST_VARS['mc_currency']; $txn_id = $HTTP_POST_VARS['txn_id']; $txn_type = $HTTP_POST_VARS['txn_type']; $first_name = $HTTP_POST_VARS['first_name']; $last_name = $HTTP_POST_VARS['last_name']; $address_street = $HTTP_POST_VARS['address_street']; $address_city = $HTTP_POST_VARS['address_city']; $address_state = $HTTP_POST_VARS['address_state']; $address_zip = $HTTP_POST_VARS['address_zip']; $address_country = $HTTP_POST_VARS['address_country']; $address_status = $HTTP_POST_VARS['address_status']; $payer_email = $HTTP_POST_VARS['payer_email']; $payer_id = $HTTP_POST_VARS['payer_id']; $payer_status = $HTTP_POST_VARS['payer_status']; $payment_type = $HTTP_POST_VARS['payment_type']; $notify_version = $HTTP_POST_VARS['notify_version']; $verify_sign = $HTTP_POST_VARS['verify_sign']; $xpayer_email = formatPaymentString($payer_email); $xtxn_id = formatPaymentString($txn_id); $xtxn_type = formatPaymentString($txn_type); $xpayment_type = formatPaymentString($payment_type); $xpayment_status = formatPaymentString($payment_status); $xpending_reason = formatPaymentString($pending_reason); $paypal_order_data = "$xpayer_email;$xtxn_id;$xtxn_type;$xpayment_type;$xpayment_status;$xpending_reason"; ######################## # Start IPN Validator ######################## if (!$fp) { echo "Problem!
Error Number: $errno
Error String: $errstr"; exit; } else { fputs($fp, $header . $req); while(!feof($fp)) { $res = fgets($fp, 1024); $res = trim($res); if (strcmp($res, "VERIFIED") == 0) { if($receiver_email == $ppemail){ if($custom == "emporium"){ if($payment_status == "Completed"){ $order_select = sql_num_rows(sql_query("SELECT * from $prefix"._cart_orders." WHERE orderID='$invoice'", $dbi), $dbi); if($order_select == 1){ $orderInfo = cartorderinfo($invoice); $grandTotal = $orderInfo[GrandTotal]; if($payment_gross == $grandTotal){ sql_query("UPDATE $prefix"._cart_orders." SET payMethodData='$paypal_order_data' WHERE orderID='$invoice'", $dbi); } } } } } } else if (strcmp($res, "INVALID") == 0) { // Uh-oh. Hacker? } } fclose($fp); } } ?>

提问者:cyber   08-14 10:10
答复
路过。。。顺便帮顶:)
回答者:玉米づ冰冻可乐 - 瓦岗村民 8-22 09:10
我也来回答:
不管你有没有帮助我们,瓦岗寨8万村民将感谢你。。。。。

为防止灌水,您需要计算一道数学题: 答案:
13 + 47 = ? 请将计算结果填在上面

 
[]
©2007 PhpRes.COM