Advertisement
Guest User

Untitled

a guest
Jan 20th, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.96 KB | None | 0 0
  1. <?php
  2.  
  3. $servers = array(
  4. "0.0.0.0:25015",
  5. "78.31.67.4:25015",
  6. "0.0.0.0:25020",
  7. "78.31.67.4:25020",
  8. "0.0.0.0:25025",
  9. "78.31.67.4:25025",
  10. "0.0.0.0:25030",
  11. "78.31.67.4:25030",
  12. "0.0.0.0:25035",
  13. "78.31.67.4:25035",
  14. "0.0.0.0:25040",
  15. "78.31.67.4:25040"
  16. );
  17.  
  18. $mysqli = new mysqli($sqlhost, $sqluser, $sqlpass, $sqldb, $sqlport);
  19.  
  20. if (mysqli_connect_errno())
  21. {
  22. printf("<strong><font color='red'>Connect failed: %s\n</font></strong>", mysqli_connect_error());
  23. exit();
  24. }
  25.  
  26. foreach ($servers as $server)
  27. {
  28. echo "Server: " . $server . "<br>"; // just for debugging
  29.  
  30. $query = "SELECT * FROM player_analytics WHERE ip = $server AND description LIKE 'classic%'";
  31.  
  32. if ($result = $mysqli->query($query))
  33. {
  34. while ($row = $result->fetch_object())
  35. {
  36. $id = $row->id;
  37. $server_ip = $row->server_ip;
  38. $name = $row->name;
  39. $auth = $row->auth;
  40. $connect_time = $row->connect_time;
  41. $connect_date = $row->connect_date;
  42. $numplayers = $row->numplayers;
  43. $map = $row->map;
  44. $duration = $row->duration;
  45. $flags = $row->flags;
  46. $ip = $row->ip;
  47. $city = $row->city;
  48. $region = $row->region;
  49. $country = $row->country;
  50. $country_code = $row->country_code;
  51. $country_code3 = $row->country_code3;
  52. $html_motd_disabled = $row->html_motd_disabled;
  53. $os = $row->os;
  54.  
  55. $insertQuery = "INSERT INTO news
  56. (server_ip, name, auth, connect_time, connect_date, numplayers, map, duration, flags, ip, city, region, country, country_code, country_code3, html_motd_disabled, os) VALUES
  57. (\"server_ip\", \"name\", \"auth\", \"connect_time\", \"connect_date\", \"numplayers\", \"map\", \"duration\", \"flags\", \"ip\", \"city\", \"region\", \"country\", \"country_code\", \"country_code3\", \"html_motd_disabled\", \"os\";";
  58.  
  59. $deleteQuery = "DELETE FROM player_analytics WHERE id = $id";
  60.  
  61. $mysqli->query($insertQuery);
  62. $mysqli->query($deleteQuery);
  63. }
  64. }
  65. }
  66. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement