Home  >  Article  >  Backend Development  >  PHP instant account payment example without signing a contract

PHP instant account payment example without signing a contract

WBOY
WBOYOriginal
2016-07-25 08:48:071305browse
http://www.jcb6.com specializes in Alipay, Tenpay and instant payment. Website recharge is worry-free
Supports any language system and instant payment.
  1. include_once ('../global.php');
  2. include_once ('../configs/website.inc.php');
  3. $syskey=$conf_arr['cfg_portalkey']; //The KEY set in the background is compared with the key value of the interface address on the software
  4. $out_trade_no=$_GET['name']; //[Username] on the software and [Payment Instructions] in Alipay transactions are equivalent to those on the website Recharge order
  5. $key=trim($_GET['key']);//The key on the interface is equal to the backend key before logical processing is performed to ensure safety
  6. $money=$_GET['money'];//Equivalent to Payment amount in transaction
  7. if($out_trade_no!=''){
  8. if($key==$syskey){
  9. $sql="select * from ke_order where out_trade_no='$out_trade_no' limit 1";
  10. $result =mysql_query($sql);
  11. $total = mysql_num_rows($result);
  12. $row=mysql_fetch_assoc($result);
  13. if($total==0){
  14. echo '0'; exit(); //Prevent Submitted maliciously
  15. }else{
  16. if($row['statu']==0){//Check whether it has been processed first, if not, continue
  17. $email=$row['email'];$mktime =mktime();
  18. if($email!==""){
  19. mysql_query("update `ke_member`set amount=amount+$money where username='$email'"); //Add money to the membership table
  20. mysql_query( "update `ke_order`set statu=1,money=$money where out_trade_no='$out_trade_no'"); //Change the recharge order information
  21. }
  22. echo '1';exit(); //Return 1 after the software receives it Displays that the recharge is successful and returns 0. After the software receives it, it displays that the recharge failed
  23. }else{
  24. echo '0';exit(); //If the order has been processed, that is, it has been credited, exit to prevent repeated crediting
  25. }
  26. }
  27. }
  28. }else{
  29. echo '0';exit();
  30. }
  31. ?>
Copy code
  1. include_once ('../configs/website.inc.php');
  2. include_once ('../global.php');
  3. if(!isset($_POST['ok' ])){
  4. echo "";exit( );
  5. }
  6. if(!isset($_SESSION['username'])){
  7. echo "";exit();
  8. }
  9. $email=$_SESSION['username']; //The username that has been logged in in the system
  10. $tradeNo="Apay".mktime( ); //Generated order number (i.e. payment instructions on the payment page)
  11. $mktime=date("Y-m-d H:i:s",mktime()); //Current time
  12. $amount=$_POST[' amount'];//Transaction amount
  13. $optemail=$conf_arr['cfg_alipayuser']; //Alipay payee account (must be real-name authenticated)
  14. $sql="insert into ke_order values(null,'$ email',$amount,'$tradeNo',0,'$mktime')";//Insert a recharge order in the mysql database
  15. mysql_query($sql);
  16. ?>
  17. Alipay online payment< ;/title></li> <li></head></li> <li><body></li> <li><form id="alipaysubmit" action="https://shenghuo.alipay.com/send/payment/fill.htm" method="post" ></li> <li><input name="title" type="hidden" value="<?php echo $tradeNo;?>" /></li> <li><input name="optEmail" type="hidden" value= "<?php echo $optemail;?>" /></li> <li><input name="payAmount" type="hidden" value="<?php echo $amount;?>" /></li> <li>< ;input name="cellphone" type="hidden" value="18779680633" /></li> <li><input name="memo" type="hidden" value="Please do not modify [Payment Instructions], otherwise automatic arrival will not be achieved Account! " /></li> <li><input name="ok" type="submit" value="Processing" /></li> <li></form></li> <li><script>document.forms['alipaysubmit'].submit( );</script></li> <li></body></li> <li></html></li> </ol></div> <em onclick="copycode($('code_F9k'));">Copy code</em> </div> <div class="blockcode"> <div id="code_I24"><ol> <li><?php<li>include_once ('../configs/website.inc.php');<li>include_once ('../global.php');<li>if(!isset($_POST['ok' ])){<li> echo "<script language="javascript">alert('Please submit through the recharge page');location.href='../index.php';</script>";exit( );</li> <li>}</li> <li>if(!isset($_SESSION['username'])){</li> <li> echo "<script language="javascript">alert('Please log in and submit');location.href='.. /index.php';</script>";exit();</li> <li>}</li> <li>$email=$_SESSION['username']; //The user name already logged in in the system</li> <li>$tradeNo="Tpay".mktime( );//The generated order number (i.e. the payment instructions on the payment page)</li> <li>$mktime=date("Y-m-d H:i:s",mktime());//The current time</li> <li>$amount=$_POST[' amount'];//Transaction amount</li> <li>$optemail=$conf_arr['cfg_tenpayuser'];//Tenpay payee account number (can be unnamed)</li> <li>$sql="insert into ke_order values(null,'$email' ,$amount,'$tradeNo',0,'$mktime')"; //Insert a recharge order in the mysql database</li> <li>mysql_query($sql);</li> <li>$md5=md5($optemail."&".$amount. "&".$tradeNo);</li> <li>?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/ xhtml1-transitional.dtd"></li> <li><html xmlns="http://www.w3.org/1999/xhtml"></li> <li><head></li> <li><meta http-equiv="Content-Type" content ="text/html; charset=utf-8" /></li> <li><title>Tenpay Online Payment
  18. <script>document.forms['alipaysubmit'].submit();</script>
Copy Code


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn