Dorename.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. include_once("../../untils/conn.php");
  3. $id = $_POST['id'];
  4. $proxy_acc = $_POST['proxy_acc'];
  5. $rename = $_POST['rename'];
  6. $reuid = $_POST['reuid'];
  7. $phone = $_POST['phone'];
  8. $status = $_POST['status'];
  9. $notes = $_POST['notes'];
  10. $uptime = time();
  11. if ($status == 1) {
  12. // 更新 rename_table 表
  13. $sql = "UPDATE rename_table SET status = $status, notes = '$notes', uptime = $uptime WHERE id = $id";
  14. if (mysqli_query($con, $sql)) {
  15. // 更新 proxy 表
  16. $sql = "UPDATE proxy SET proxy_rename = '$rename', proxy_uid = '$reuid', proxy_phone = '$phone', proxy_rename_sta = $status WHERE proxy_acc = '$proxy_acc'";
  17. if (mysqli_query($con, $sql)) {
  18. // 弹窗操作成功
  19. echo "<script>alert('操作成功'); setTimeout(function(){ window.location.href = '../rename.php'; }, 1000);</script>";
  20. } else {
  21. // 弹窗操作失败
  22. echo "<script>alert('操作失败'); setTimeout(function(){ window.location.href = '../rename.php'; }, 1000);</script>";
  23. }
  24. } else {
  25. // 弹窗操作失败
  26. echo "<script>alert('操作失败'); setTimeout(function(){ window.location.href = '../rename.php'; }, 1000);</script>";
  27. }
  28. } elseif ($status == 2) {
  29. // 只更新 rename_table 表
  30. $sql = "UPDATE rename_table SET status = $status, notes = '$notes', uptime = $uptime WHERE id = $id";
  31. if (mysqli_query($con, $sql)) {
  32. // 弹窗操作成功
  33. echo "<script>alert('操作成功'); setTimeout(function(){ window.location.href = '../rename.php'; }, 1000);</script>";
  34. } else {
  35. // 弹窗操作失败
  36. echo "<script>alert('操作失败'); setTimeout(function(){ window.location.href = '../rename.php'; }, 1000);</script>";
  37. }
  38. } else {
  39. // 弹窗操作失败(未知的 status 值)
  40. echo "<script>alert('操作失败'); setTimeout(function(){ window.location.href = '../rename.php'; }, 1000);</script>";
  41. }
  42. mysqli_close($con);
  43. ?>