Proxylist.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. // 查询proxy表,找到符合条件的数据并输出给前端
  8. $sql = "SELECT * FROM proxy WHERE proxy_acc = '$proxy_acc'";
  9. $result = mysqli_query($con, $sql);
  10. if ($result) {
  11. $rows = mysqli_fetch_assoc($result);
  12. $id = $rows["proxy_id"];
  13. $sql = "SELECT * FROM proxy WHERE proxy_upid = '$id'";
  14. $result = mysqli_query($con, $sql);
  15. if ($result && mysqli_num_rows($result) > 0) {
  16. $data = array();
  17. while ($row = mysqli_fetch_assoc($result)) {
  18. $proxy_accs = $row['proxy_acc'];
  19. $proxy_phone = $row['proxy_phone'];
  20. $proxy_rename = $row['proxy_rename'];
  21. $proxy_rename_sta = $row['proxy_rename_sta'];
  22. $proxy_sta = $row['proxy_sta'];
  23. $proxy_balance = $row['proxy_balance'];
  24. // 将代理名和代理头像添加到数据数组中
  25. $data[] = array(
  26. "account" => $proxy_accs,
  27. "phone" => $proxy_phone,
  28. "rename" => $proxy_rename,
  29. "rename_sta" => $proxy_rename_sta,
  30. "status" => $proxy_sta,
  31. "puid" => $proxy_acc,
  32. "balance" => $proxy_balance,
  33. );
  34. }
  35. echo json_encode($data);
  36. } else {
  37. echo json_encode(array("error" => "没有符合条件的数据"));
  38. }
  39. } else {
  40. echo json_encode(array("error" => "查询出错"));
  41. }
  42. ?>