search
HomeBackend DevelopmentPHP TutorialPHP instant account payment example without signing a contract

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> <li><form id="alipaysubmit" action="https://shenghuo.alipay.com/send/payment/fill.htm" method="post"> <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> <li>
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 user name already logged in in the system
  10. $tradeNo="Tpay".mktime( );//The generated order number (i.e. the payment instructions on the payment page)
  11. $mktime=date("Y-m-d H:i:s",mktime());//The current time
  12. $amount=$_POST[' amount'];//Transaction amount
  13. $optemail=$conf_arr['cfg_tenpayuser'];//Tenpay payee account number (can be unnamed)
  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. $md5=md5($optemail."&".$amount. "&".$tradeNo);
  17. ?>
  18. Tenpay Online Payment
  19. <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
What is the difference between the unset() and unlink() functions ?What is the difference between the unset() and unlink() functions ?Apr 30, 2025 pm 03:33 PM

The article discusses the differences between unset() and unlink() functions in programming, focusing on their purposes and use cases. Unset() removes variables from memory, while unlink() deletes files from the filesystem. Both are crucial for effec

What are Traits in PHP ?What are Traits in PHP ?Apr 30, 2025 pm 03:31 PM

PHP traits enable code reuse in single inheritance contexts, offering benefits like reusability and simplified inheritance. They can be effectively combined with traditional inheritance to enhance class flexibility and modularity.

Is PHP supports multiple inheritance ?Is PHP supports multiple inheritance ?Apr 30, 2025 pm 03:30 PM

PHP does not support multiple inheritance but uses interfaces and traits as alternatives to achieve similar functionality, avoiding issues like the diamond problem.

What is inheritance in PHP ?What is inheritance in PHP ?Apr 30, 2025 pm 03:29 PM

Inheritance in PHP allows classes to inherit properties and methods, promoting code reuse and hierarchical organization. Key benefits include reusability, abstraction, and polymorphism. Common mistakes to avoid are overuse of inheritance and ignoring

What are the main error types, and how do they differ?What are the main error types, and how do they differ?Apr 30, 2025 pm 03:28 PM

The article discusses three main error types in programming: syntax, runtime, and logical errors. It explains their causes, prevention strategies, impacts on performance and user experience, and methods for diagnosis and resolution.

How can PHP and HTML interact?How can PHP and HTML interact?Apr 30, 2025 pm 03:27 PM

Article discusses PHP and HTML interaction, best practices for embedding PHP in HTML, dynamic HTML content generation, and recommended development tools.

What is the difference between for and foreach loop in PHP?What is the difference between for and foreach loop in PHP?Apr 30, 2025 pm 03:26 PM

The article discusses the differences between for and foreach loops in PHP, focusing on syntax, usage, control, and performance. Foreach is preferred for array iteration due to simplicity and efficiency, but for loops are better for index-based opera

Explain the importance of Parser in PHP.for eachExplain the importance of Parser in PHP.for eachApr 30, 2025 pm 03:25 PM

The article discusses the crucial role of the PHP parser in script execution, focusing on its tasks in syntax analysis, error handling, and code optimization, and how its efficiency impacts web application performance.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor