DoUpProxy.php 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. <?php
  2. session_start();
  3. include_once("../../untils/conn.php");
  4. mysqli_query($con, "set names utf8");
  5. // 获取当前正在登录的账号信息的代理
  6. $proxy_acc = $_SESSION["account"];
  7. $time = time();
  8. // 引用验证身份证信息的函数文件
  9. include_once("public/verifyidcard.php");
  10. // 处理提交的重命名表单数据
  11. if (isset($_POST['proxy_rename'])) {
  12. $proxy_rename = $_POST['proxy_rename'];
  13. $proxy_uid = $_POST['proxy_uid'];
  14. $proxy_phone = $_POST['proxy_phone'];
  15. $verification_code = $_POST['verification_code'];
  16. // 调试输出
  17. // echo "姓名: " . $proxy_rename . "<br>";
  18. // echo "身份证号: " . $proxy_uid . "<br>";
  19. // echo "手机号: " . $proxy_phone . "<br>";
  20. // echo "验证码: " . $verification_code . "<br>";
  21. // exit;
  22. // 验证身份证号格式
  23. if (!verifyIdCard($proxy_uid)) {
  24. $response = array('code' => -2, 'msg' => '身份证号有误');
  25. echo json_encode($response);
  26. exit;
  27. }
  28. // 查询验证码
  29. $query = "SELECT * FROM vercodes WHERE phone = '$proxy_phone' AND code = '$verification_code'";
  30. $result = mysqli_query($con, $query);
  31. $row = mysqli_fetch_assoc($result);
  32. if (!$row) {
  33. // 验证码不正确
  34. $response = array('code' => 3, 'msg' => '验证码不正确');
  35. echo json_encode($response);
  36. exit;
  37. }
  38. // 验证验证码有效期
  39. $sutime = $row['sutime'];
  40. if ($time - $sutime > 300) {
  41. // 验证码已过期
  42. $response = array('code' => 4, 'msg' => '验证码已过期');
  43. echo json_encode($response);
  44. exit;
  45. }
  46. // 查询system表中type为xitong的数据
  47. $query = "SELECT * FROM system WHERE type = 'xitong'";
  48. $result = mysqli_query($con, $query);
  49. $systemData = mysqli_fetch_assoc($result);
  50. if ($systemData) {
  51. // 取出auto字段的值
  52. $auto = $systemData['auto'];
  53. if ($auto == 1) {
  54. // auto等于1时,更新rename_table和proxy表的数据
  55. $query = "INSERT INTO rename_table (proxy_acc, `rename`, reuid, phone, sutime, status) VALUES ('$proxy_acc', '$proxy_rename', '$proxy_uid', '$proxy_phone', '$time', 1)";
  56. $result = mysqli_query($con, $query);
  57. $query = "UPDATE proxy SET proxy_rename='$proxy_rename', proxy_uid='$proxy_uid', proxy_phone='$proxy_phone', proxy_rename_sta=1 WHERE proxy_acc='$proxy_acc'";
  58. $result = mysqli_query($con, $query);
  59. if ($result) {
  60. // 更新成功
  61. $response = array(
  62. 'code' => 2,
  63. 'msg' => '实名成功!'
  64. );
  65. echo json_encode($response);
  66. exit;
  67. } else {
  68. // 更新失败
  69. $response = array(
  70. 'code' => -1,
  71. 'msg' => '系统出错,请稍后再试!'
  72. );
  73. echo json_encode($response);
  74. exit;
  75. }
  76. } else {
  77. // auto不等于1时,只执行插入操作
  78. $query = "INSERT INTO rename_table (proxy_acc, `rename`, reuid, phone, sutime) VALUES ('$proxy_acc', '$proxy_rename', '$proxy_uid', '$proxy_phone', '$time')";
  79. $result = mysqli_query($con, $query);
  80. if ($result) {
  81. // 插入成功
  82. $response = array(
  83. 'code' => 2,
  84. 'msg' => '提交成功,请等待审核!'
  85. );
  86. echo json_encode($response);
  87. exit;
  88. } else {
  89. // 插入失败
  90. $response = array(
  91. 'code' => -1,
  92. 'msg' => '系统出错,请稍后再试!'
  93. );
  94. echo json_encode($response);
  95. exit;
  96. }
  97. }
  98. } else {
  99. // system表中没有type为xitong的数据
  100. $response = array('code' => -3, 'msg' => '系统数据不存在');
  101. echo json_encode($response);
  102. exit;
  103. }
  104. }
  105. // 处理提交的支付宝表单数据
  106. if (isset($_POST['alipay_name']) && isset($_POST['alipay_acc'])) {
  107. // var_dump($_POST);
  108. $alipay_name = $_POST['alipay_name'];
  109. $alipay_acc = $_POST['alipay_acc'];
  110. $query = "UPDATE proxy SET proxy_alipay='$alipay_name', proxy_alipay_acc='$alipay_acc' WHERE proxy_acc='$proxy_acc'";
  111. $result = mysqli_query($con, $query);
  112. if ($result) {
  113. // 更新成功
  114. $response = array(
  115. 'code' => 2,
  116. 'msg' => '绑定成功!'
  117. );
  118. echo json_encode($response);
  119. exit;
  120. } else {
  121. // 更新失败
  122. $response = array(
  123. 'code' => -1,
  124. 'msg' => '绑定失败,请稍后再试!'
  125. );
  126. echo json_encode($response);
  127. exit;
  128. }
  129. }
  130. // 处理提交的银行表单数据
  131. if (isset($_POST['bank_name'])) {
  132. $bank_name = $_POST['bank_name'];
  133. $bank_acc = $_POST['bank_acc'];
  134. $proxy_bank_name = $_POST['proxy_bank_name'];
  135. $proxy_bank_zh = $_POST['proxy_bank_zh'];
  136. // 调试输出
  137. // echo "姓名: " . $bank_name . "<br>";
  138. // echo "卡号: " . $bank_acc . "<br>";
  139. // echo "银行: " . $proxy_bank_name . "<br>";
  140. // echo "支行: " . $proxy_bank_zh . "<br>";
  141. // 在这里处理银行表单的数据
  142. $query = "UPDATE proxy SET proxy_yihname='$bank_name', proxy_yhnum='$bank_acc', proxy_bank_name='$proxy_bank_name', proxy_bank_zh='$proxy_bank_zh' WHERE proxy_acc='$proxy_acc'";
  143. $result = mysqli_query($con, $query);
  144. if ($result) {
  145. // 更新成功
  146. $response = array(
  147. 'code' => 2,
  148. 'msg' => '绑定成功!'
  149. );
  150. echo json_encode($response);
  151. exit;
  152. } else {
  153. // 更新失败
  154. $response = array(
  155. 'code' => -1,
  156. 'msg' => '绑定失败,请稍后再试!'
  157. );
  158. echo json_encode($response);
  159. exit;
  160. }
  161. }
  162. ?>