123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- <?php
- session_start();
- include_once("../../untils/conn.php");
- mysqli_query($con, "set names utf8");
- if ($_SERVER['REQUEST_METHOD'] == 'POST') {
- $tx_price = $_POST['tx_price'];
- // 对 $tx_price 进行验证和过滤
- if ($tx_price <= 1) {
- echo "<script>alert('提现金额不能低于1元,请重新输入');window.location.href='../withdrawal.php'</script> ";
- exit(); // 结束代码的执行
- }
- $tx_type = $_POST['tx_type'];
- // 对 $tx_type 进行验证和过滤
- $cr_time = $_POST['cr_time'];
- // 获取时间戳
- $proxy_acc = $_POST ['proxy_acc'];
- // 根据 $tx_type 的值,获取其他表单字段的值
- if ($tx_type == '1') {
- $alipay_name = $_POST['alipay_name'];
- // 对 $alipay_name 进行验证和过滤
- $alipay_account = $_POST['alipay_account'];
- // 对 $alipay_account 进行验证和过滤
-
- // 执行提现操作
- $sql = "UPDATE proxy SET proxy_balance = proxy_balance - ? WHERE proxy_acc = ?";
- $stmt = mysqli_prepare($con, $sql);
- mysqli_stmt_bind_param($stmt, "ds", $tx_price, $proxy_acc);
- mysqli_stmt_execute($stmt);
- mysqli_stmt_close($stmt);
-
- // 将数据插入到数据库表中
- $sql = "INSERT INTO withdrawal (proxy_acc, tx_price, tx_type, tx_name, tx_acc, cr_time) VALUES (?, ?, ?, ?, ?, ?)";
- $stmt = mysqli_prepare($con, $sql);
- mysqli_stmt_bind_param($stmt, "sdssss", $proxy_acc, $tx_price, $tx_type, $alipay_name, $alipay_account, $cr_time);
- if(mysqli_stmt_execute($stmt)){
- echo "<script>alert('提现申请已提交');window.location.href='../withdrawal.php'</script> ";
- }else{
- echo "<script>alert('提交失败了,请稍后再试');window.location.href='../withdrawal.php'</script> ";
- }
- mysqli_stmt_close($stmt);
- } elseif ($tx_type == '2') {
- $tx_name = $_POST['tx_name'];
- // 对 $tx_name 进行验证和过滤
- $tx_acc = $_POST['tx_acc'];
- // $tx_acc 进行验证和过滤
- $bank_name = $_POST['bank_name'];
- // 对 $bank_name 进行验证和过滤
- $bank_branch = $_POST['bank_branch'];
- // 对 $bank_branch 进行验证和过滤
-
- // 执行提现操作
- $sql = "UPDATE proxy SET proxy_balance = proxy_balance - ? WHERE proxy_acc = ?";
- $stmt = mysqli_prepare($con, $sql);
- mysqli_stmt_bind_param($stmt, "ds", $tx_price, $proxy_acc);
- mysqli_stmt_execute($stmt);
- mysqli_stmt_close($stmt);
-
- // 将数据插入到数据库表中
- $sql = "INSERT INTO withdrawal (proxy_acc, tx_price, tx_type, tx_name, tx_acc, tx_bank_name, tx_bank_zh, cr_time) VALUES (?, ?, ?, ?, ?, ?, ?, ?)";
- $stmt = mysqli_prepare($con, $sql);
- mysqli_stmt_bind_param($stmt, "sdssssss", $proxy_acc, $tx_price, $tx_type, $tx_name, $tx_acc, $bank_name, $bank_branch, $cr_time);
- if(mysqli_stmt_execute($stmt)){
- echo "<script>alert('提现申请已提交');window.location.href='../withdrawal.php'</script> ";
- }else{
- echo "<script>alert('提交失败了,请稍后再试');window.location.href='../withdrawal.php'</script> ";
- }
- mysqli_stmt_close($stmt);
- }
- }
- ?>
|