Dowith.php 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php
  2. session_start();
  3. include_once("../../untils/conn.php");
  4. mysqli_query($con, "set names utf8");
  5. if ($_SERVER['REQUEST_METHOD'] == 'POST') {
  6. $tx_price = $_POST['tx_price'];
  7. // 对 $tx_price 进行验证和过滤
  8. if ($tx_price <= 1) {
  9. echo "<script>alert('提现金额不能低于1元,请重新输入');window.location.href='../withdrawal.php'</script> ";
  10. exit(); // 结束代码的执行
  11. }
  12. $tx_type = $_POST['tx_type'];
  13. // 对 $tx_type 进行验证和过滤
  14. $cr_time = $_POST['cr_time'];
  15. // 获取时间戳
  16. $proxy_acc = $_POST ['proxy_acc'];
  17. // 根据 $tx_type 的值,获取其他表单字段的值
  18. if ($tx_type == '1') {
  19. $alipay_name = $_POST['alipay_name'];
  20. // 对 $alipay_name 进行验证和过滤
  21. $alipay_account = $_POST['alipay_account'];
  22. // 对 $alipay_account 进行验证和过滤
  23. // 执行提现操作
  24. $sql = "UPDATE proxy SET proxy_balance = proxy_balance - ? WHERE proxy_acc = ?";
  25. $stmt = mysqli_prepare($con, $sql);
  26. mysqli_stmt_bind_param($stmt, "ds", $tx_price, $proxy_acc);
  27. mysqli_stmt_execute($stmt);
  28. mysqli_stmt_close($stmt);
  29. // 将数据插入到数据库表中
  30. $sql = "INSERT INTO withdrawal (proxy_acc, tx_price, tx_type, tx_name, tx_acc, cr_time) VALUES (?, ?, ?, ?, ?, ?)";
  31. $stmt = mysqli_prepare($con, $sql);
  32. mysqli_stmt_bind_param($stmt, "sdssss", $proxy_acc, $tx_price, $tx_type, $alipay_name, $alipay_account, $cr_time);
  33. if(mysqli_stmt_execute($stmt)){
  34. echo "<script>alert('提现申请已提交');window.location.href='../withdrawal.php'</script> ";
  35. }else{
  36. echo "<script>alert('提交失败了,请稍后再试');window.location.href='../withdrawal.php'</script> ";
  37. }
  38. mysqli_stmt_close($stmt);
  39. } elseif ($tx_type == '2') {
  40. $tx_name = $_POST['tx_name'];
  41. // 对 $tx_name 进行验证和过滤
  42. $tx_acc = $_POST['tx_acc'];
  43. // $tx_acc 进行验证和过滤
  44. $bank_name = $_POST['bank_name'];
  45. // 对 $bank_name 进行验证和过滤
  46. $bank_branch = $_POST['bank_branch'];
  47. // 对 $bank_branch 进行验证和过滤
  48. // 执行提现操作
  49. $sql = "UPDATE proxy SET proxy_balance = proxy_balance - ? WHERE proxy_acc = ?";
  50. $stmt = mysqli_prepare($con, $sql);
  51. mysqli_stmt_bind_param($stmt, "ds", $tx_price, $proxy_acc);
  52. mysqli_stmt_execute($stmt);
  53. mysqli_stmt_close($stmt);
  54. // 将数据插入到数据库表中
  55. $sql = "INSERT INTO withdrawal (proxy_acc, tx_price, tx_type, tx_name, tx_acc, tx_bank_name, tx_bank_zh, cr_time) VALUES (?, ?, ?, ?, ?, ?, ?, ?)";
  56. $stmt = mysqli_prepare($con, $sql);
  57. mysqli_stmt_bind_param($stmt, "sdssssss", $proxy_acc, $tx_price, $tx_type, $tx_name, $tx_acc, $bank_name, $bank_branch, $cr_time);
  58. if(mysqli_stmt_execute($stmt)){
  59. echo "<script>alert('提现申请已提交');window.location.href='../withdrawal.php'</script> ";
  60. }else{
  61. echo "<script>alert('提交失败了,请稍后再试');window.location.href='../withdrawal.php'</script> ";
  62. }
  63. mysqli_stmt_close($stmt);
  64. }
  65. }
  66. ?>