Guest User

Untitled

a guest
May 20th, 2018
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.17 KB | None | 0 0
  1. <?php
  2. set_time_limit(0);
  3. error_reporting(E_ALL);
  4. include('connect.php');
  5. include('funkcijos.php');
  6. function microtime_float() {
  7.     list($utime, $time) = explode(" ", microtime());
  8.     return ((float)$utime + (float)$time);
  9. }
  10. $start = microtime_float();
  11.  
  12. $mysql = mysql_query("SELECT * FROM serveriai");
  13. $i = 0;
  14. while($row = mysql_fetch_array($mysql)){
  15. $i++;
  16. if ($i > 10){break;}
  17. $id = $row['id'];
  18. $ip = $row['ip'];
  19. $tipas = $row['tipas'];
  20. $port = $row['port'];
  21. $vote = $row['vote'];
  22. $time = time();
  23. //echo $ip . ':' . $port . '<br />';
  24. if (Online($ip, $port)){$status = "online";}else{$status = "offline"; $hostname = "Serveris išjungtas!";}
  25. if ($status == "online"){
  26. $array = Query($ip, 25565);
  27. echo $status;
  28. print_r( $array );
  29. echo $players = $array['Players'];
  30. echo $maxplayers = $array['MaxPlayers'];
  31. echo $hostname = $array['HostName'];
  32. echo 'online';
  33. }
  34.  
  35. mysql_query("UPDATE serveriai SET statusas='$status', hostname='$hostname', players='$players', maxplayers='$maxplayers', timestamp='$time' WHERE id='$id' ");
  36. //echo $id . "<br />";
  37. echo $i;
  38. }
  39.  
  40.  
  41. $end = microtime_float();
  42. echo "<br>Skriptas įvygdytas per ".bcsub($end,$start,2)." sek.";
  43. ?>
Add Comment
Please, Sign In to add comment