Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [PHP] skrypt i błędy
Forum PHP.pl > Forum > Przedszkole
samone-x
Witam
Może mi ktoś wytłumaczyć dlaczego występują te błędy?



Skrypt znalazłem w sieci, nie zmieniałem nic oprócz IP i portu
używam vertrigo, a plik nazwałem index.php

  1. <?php
  2. if (!$server) {
  3. $server_ip = "178.20.168.72"; // ik typte gewoon wat in
  4. $server_port = "12203"; // ik typte gewoon wat in
  5. } else {
  6. $server = explode(":", $server);
  7. $server_ip = $server[0];
  8. $server_port = $server[1];
  9. }
  10. // Do NOT change anything below this line!
  11.  
  12. // Creating the URL for the connection:
  13.  
  14. $server_ip = "udp://" . $server_ip;
  15.  
  16. // Open the connection:
  17. $connect = fsockopen($server_ip, $server_port, $errno, $errstr, 30);
  18.  
  19. // Set the timeout:
  20. socket_set_timeout ($connect, 1, 000000);
  21.  
  22. // Get the information from the server, and put it into the $output array:
  23.  
  24. $send = "?questionmark.gif?" . chr (0x02) . "getstatus";
  25. fputs($connect, $send);
  26. fwrite ($connect, $send);
  27. $output = fread ($connect, 1);
  28. if (! empty ($output)) {
  29. do {
  30. $status_pre = socket_get_status ($connect);
  31. $output = $output . fread ($connect, 1);
  32. $status_post = socket_get_status ($connect);
  33. } while ($status_pre[unread_bytes] != $status_post[unread_bytes]);
  34. };
  35.  
  36. // Close the connection:
  37. fclose($connect);
  38.  
  39. // Select the variables from the $output array:
  40. $output = explode ("\\", $output);
  41.  
  42. $max_index = array_search ("sv_maxclients", $output);
  43. $max_clients = $output[$max_index+1];
  44.  
  45. $max_index = array_search ("mapname", $output);
  46. $mapname = $output[$max_index+1];
  47.  
  48. $max_index = array_search ("sv_hostname", $output);
  49. $hostname = $output[$max_index+1];
  50.  
  51. $max_index = array_search ("g_gametypestring", $output);
  52. $gametype = $output[$max_index+1];
  53.  
  54. $last_value = count($output) - 1;
  55. $players_string = $output[$last_value];
  56. $players_string = explode("\"", $players_string);
  57.  
  58. $get_first_ping = explode("\n", $players_string[0]);
  59. $players_string[0] = $get_first_ping[1];
  60.  
  61. $i = 1;
  62. $players = 0;
  63. while (count($players_string) != $i) {
  64. $i++;
  65. $i++;
  66. $players++;
  67. }
  68.  
  69. // Create the image url:
  70. if (substr($mapname, 0, 3) == "dm/") {
  71. $picture_src = str_replace("dm/", "", $mapname);
  72. } else {
  73. $picture_src = str_replace("obj/", "", $mapname);
  74. }
  75. $picture_src = "images/" . $picture_src . ".jpg";
  76.  
  77.  
  78. // Start the output:
  79. ?>
  80. <html>
  81. <head>
  82. <title><?=$hostname?></title>
  83. </head>
  84. <body>
  85. <table width="600" border="0" align="center">
  86. <caption><b><?=$hostname?></b></caption>
  87. <tr>
  88. <td width="256" valign="top" bgcolor="#a3a379">
  89. <table border="0">
  90. <tr>
  91. <td bgcolor="#939164" width="256">Game: <?=$gametype?><td>
  92. </tr>
  93. <tr>
  94. <td bgcolor="#939164" width="256">Players: <?=$players?>/<?=$max_clients?></td>
  95. </tr>
  96. <tr>
  97. <td bgcolor="#939164" width="256">Map: <?=$mapname?></td>
  98. </tr>
  99. <tr>
  100. <td bgcolor="#939164" width="256"><img src="<?=$picture_src?>"></td>
  101. </tr>
  102. </table>
  103. </td>
  104. <td valign="top" bgcolor="#a3a379">
  105. <table border="0">
  106. <tr>
  107. <td bgcolor="#939164" width="300">Player name:</td>
  108. <td bgcolor="#939164" width="44">Ping:</td>
  109. </tr>
  110. <?
  111. $i = 1;
  112. while (count($players_string) != $i) {
  113. $j = $i -1;
  114. ?>
  115. <tr>
  116. <td bgcolor="#939164" width="300">
  117. <?=$players_string[$i]?>
  118. </td>
  119. <td bgcolor="#939164" width="44">
  120. <?=$players_string[$j]?>
  121. </td>
  122. </tr>
  123. <?
  124. $i = $i + 2;
  125. }
  126. ?>
  127. </table>
  128. </td>
  129. </tr>
  130. </table>
  131. </body>
  132. </html>
  133. <?
  134. ?>
kadlub
poszukaj na forum to się dowiesz
ostatnio było kilka takich pytań jak nie kilka naście

w php.ini
ustaw
error_reporting = E_ALL & ~E_NOTICE
http://www.php.net/manual/en/errorfunc.con...error-reporting
albo użyj isset()
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.