Doproxy_sta.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. include_once("../../untils/conn.php");
  3. // $proxy_id = $_GET['proxy_id'];
  4. $proxy_id = $_POST['proxy_id'];
  5. $state_ban = $_POST['state_ban'];
  6. // echo $proxy_id;
  7. // 查询proxy表中proxy_sta等于$proxy_id的数据
  8. $sql = "SELECT * FROM proxy WHERE proxy_id = $proxy_id";
  9. $result = mysqli_query($con, $sql);
  10. if (mysqli_num_rows($result) > 0) {
  11. // 如果查询结果存在数据,则进行修改操作
  12. $row = mysqli_fetch_assoc($result);
  13. $proxy_sta = $row['proxy_sta'];
  14. // 判断proxy_sta的值并进行修改
  15. if ($proxy_sta == 0) {
  16. $update_sql = "UPDATE proxy SET proxy_sta = 1 WHERE proxy_id = $proxy_id";
  17. } else {
  18. $update_sql = "UPDATE proxy SET proxy_sta = 0, state_ban ='$state_ban' WHERE proxy_id = $proxy_id";
  19. }
  20. $update_result = mysqli_query($con, $update_sql);
  21. if ($update_result) {
  22. echo "<script>alert('操作成功');</script>";
  23. echo ("<script>window.location.href='../proxylist.php'</script>");
  24. } else {
  25. // echo "Error updating record: " . $con->error;
  26. echo "<script>alert('操作失败');</script>";
  27. echo ("<script>window.location.href='../proxylist.php'</script>");
  28. }
  29. } else {
  30. // echo "Error updating record: " . $con->error;
  31. echo "<script>alert('未查询到相关数据');</script>";
  32. echo ("<script>window.location.href='../proxylist.php'</script>");
  33. }
  34. ?>