Advertisement
Guest User

Minecraft server query

a guest
Sep 8th, 2014
1,062
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.45 KB | None | 0 0
  1. <?php
  2. //ini_set("display_errors", 1);
  3. //ini_set("track_errors", 1);
  4. //ini_set("html_errors", 1);
  5. //error_reporting(E_ALL);
  6. $SERVER_IP = "mc.roadpvp.it"; //IP del server
  7. $SERVER_PORT = "25565"; //Porta da pingare
  8. $QUERY_PORT = "25565"; //Porta del query.port="".
  9. $HEADS = "3D"; //"normal" oppure "3D"
  10. $SHOW_FAVICON = "on"; //"off" / "on"
  11. $TITLE = "RoadPvP";
  12. $TITLE_BLOCK_ONE = "Info";
  13. $TITLE_BLOCK_TWO = "Giocatori on-line";
  14. //Fine config
  15. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  16. $ping = json_decode(file_get_contents('http://api.minetools.eu/ping/' . $SERVER_IP . '/' . $SERVER_PORT . ''), true);
  17. $query = json_decode(file_get_contents('http://api.minetools.eu/query/' . $SERVER_IP . '/' . $QUERY_PORT . ''), true);
  18. //* DEBUG AREA
  19. //var_dump($serverdata);
  20. //echo "<br>";echo "<br>";
  21. //var_dump($userlistserver);
  22. //echo "<br>";echo "<br>";
  23. //* DEBUG AREA
  24. //Array dati
  25. if(empty($ping['error'])) {
  26. $version = $ping['version']['name'];
  27. $online = $ping['players']['online'];
  28. $max = $ping['players']['max'];
  29. $motd = $ping['description'];
  30. $favicon = $ping['favicon'];
  31. }
  32. if(empty($query['error'])) {
  33. $playerlist = $query['Playerlist'];
  34. }
  35. $array_list = $data_list[$SERVER_IP]['player']['list'];
  36. $queryerror = "false";
  37. if(isset($data_list['error']) || !empty($data_list['error']) ) {
  38. $queryerror = "true";
  39. }
  40. $haserror = "false";
  41. if($data_general['status'] != "true") {
  42. $haserror = "true";
  43. }
  44. ?>
  45. <!DOCTYPE html>
  46. <html>
  47. <head>
  48. <meta charset="utf-8">
  49. <title><?php echo htmlspecialchars($TITLE); ?></title>
  50. <link rel="stylesheet" href="https://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.no-icons.min.css">
  51. <link href='http://fonts.googleapis.com/css?family=Lato:300,400' rel='stylesheet' type='text/css'>
  52. <link href="https://netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css" rel="stylesheet">
  53. <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
  54. <script type="text/javascript" src="https://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/js/bootstrap.min.js"></script>
  55. <script language="javascript">
  56. jQuery(document).ready(function(){
  57. $("[rel='tooltip']").tooltip();
  58. });
  59. </script>
  60. <style>
  61. /*Custom CSS*/
  62. body {
  63. font-family: 'Lato', sans-serif !important;
  64. }
  65. </style>
  66. </head>
  67. <body>
  68. <div class="container">
  69. <h1><a href="http://roadpvp.altervista.org"><?php echo htmlspecialchars($TITLE); ?></a></h1><hr>
  70. <div class="row">
  71. <div class="span4">
  72. <h3><?php echo htmlspecialchars($TITLE_BLOCK_ONE); ?></h3>
  73. <table class="table table-striped">
  74. <tbody>
  75. <tr>
  76. <td><b>IP</b></td>
  77. <td><?php echo $SERVER_IP; ?></td>
  78. </tr>
  79. <?php if(empty($ping['error'])) { ?>
  80. <tr>
  81. <td><b>Versione</b></td>
  82. <td><?php echo $version; ?></td>
  83. </tr>
  84. <?php } ?>
  85. <?php if(empty($ping['error'])) { ?>
  86. <tr>
  87. <td><b>Giocatori</b></td>
  88. <td><?php echo "".$online." / ".$max."";?></td>
  89. </tr>
  90. <?php } ?>
  91. <tr>
  92. <td><b>Stato</b></td>
  93. <td><?php if(empty($ping['error'])) { echo "<i class=\"icon-ok-sign\"><strong><p style='color:green'></i> Online</strong></p>"; } else { echo "<i class=\"icon-remove-sign\"></i> <strong><p style='color:red'><Online</strong>";}?></td>
  94. </tr>
  95. <?php if(empty($ping['error'])) { ?>
  96. <?php if(!empty($favicon)) { ?>
  97. <?php if ($SHOW_FAVICON == "on") { ?>
  98. <tr>
  99. <td><b>Favicon</b></td>
  100. <td><img src='<?php echo $favicon; ?>' width="32px" height="32px" style="float:left;"/></td>
  101. </tr>
  102. <?php } ?>
  103. <?php } ?>
  104. <?php } ?>
  105. </tbody>
  106. </table>
  107. </div>
  108. <div class="span8">
  109. <h3><?php echo htmlspecialchars($TITLE_BLOCK_TWO); ?></h3>
  110. <?php
  111. if($HEADS == "3D") {
  112. $url = "https://cravatar.eu/helmhead/";
  113. } else {
  114. $url = "https://cravatar.eu/helmavatar/";
  115. }
  116. if(empty($query['error'])) {
  117. if($playerlist != "null") {
  118. foreach ($playerlist as $player) { ?>
  119. <a data-placement="top" rel="tooltip" style="display: inline-block;" title="<?php echo $player;?>">
  120. <img src="<?php echo $url.$player;?>/50" size="40" width="40" height="40" onmouseover="this.filters.alpha.opacity='100'" onmouseout="this.filters.alpha.opacity='50'" style="FILTER: alpha(opacity=50); moz-opacity: 50%; width: 40px; height: 40px; margin-bottom: 5px; margin-right: 5px; border-radius: 3px; "/></a>
  121. <?php   }
  122. } else {
  123. echo "<div class=\"alert\"> Nessun giocatore online</div>";
  124. }
  125. } else {
  126. echo "<div class=\"alert\"> Abilita la query nel file server.properties!</div>";
  127. } ?>
  128. </div>
  129. </div>
  130. </div>
  131. </body>
  132. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement