post.php
<?php require_once 'config.php'; $ddh=trim(htmlspecialchars($_POST['ddh'])); //支付宝交易号 $money=trim(htmlspecialchars($_POST['money'])); //付款金额 $name=trim(htmlspecialchars($_POST['name'])); //付款说明,参数一 $key=trim(htmlspecialchars($_POST['key'])); //密钥 $addtime=date('Y-m-d H:i:s',time()); $name=str_replace('付款-','',$name);//去掉付款说明的空格 $stage="recharge"; $type=1; $addtime=date('Y-m-d H:i:s',time()); $comm = "alipay"; if($key == '168szb262589546'){ $rss=mysql_query("SELECT * FROM user WHERE id='$name'"); $rows=mysql_fetch_array($rss); $remain_money=$rows['money']; $rs=mysql_query("SELECT * FROM pay_order WHERE outer_order_no='$ddh'"); $row=mysql_fetch_array($rs); if($row['status']==""&&$rows['id']<>""){ mysql_query("UPDATE user set money=money+".$money." WHERE id='$name'"); $aa="INSERT INTO pay_order (user_id,order_no,outer_order_no,pay_money,status,type,addtime,comm) VALUES ('$name','$name','$ddh','$money','$type','$type','$addtime','$comm')"; mysql_query($aa); //写日志 $bb="INSERT INTO account_log (user_id,stage,money,remain_money,comm,addtime) VALUES ('$name','$stage','$money','$remain_money','$name','$addtime')"; mysql_query($bb); echo "okokokokokok"; } if($row['status']<>"")echo '该订单已充值过!'; }else{ echo '密钥错误no!'; } ?>