Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [PHP]Statystyki Shoutcast error500
Forum PHP.pl > Forum > Przedszkole
johny009
Witam, mam dość spory problem z skryptem statystyk wyświetlającym liczbe słuchaczy itp. Odtrzymuje błąd 500 od serwera (netart) zapis z loga następujący

[Fri Mar 16 22:37:26 2012] [error] [client 66.249.66.136] Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.

Całość skryptu shoutcasta:
  1. <?
  2. $sc[czas] = 180;
  3. $sc[host] = "188.165.220.98";
  4. $sc[port] = 8888;
  5. $sc[listen] = "http://188.165.220.98:8888/listen.pls";
  6.  
  7. $sc[template1] = "[radio]";
  8. $sc[template2] = "[aim]";
  9.  
  10. if($fp = fsockopen($sc[host], $sc[port]))
  11. {
  12. fputs($fp,"GET /index.html HTTP/1.0\r\nUser-Agent: XML Getter (Mozilla Compatible)\r\n\r\n");
  13. fgets($fp);fgets($fp);fgets($fp);
  14. while(!feof($fp)) $in.=strip_tags(fgets($fp));
  15. fclose($fp);
  16.  
  17.  
  18. // [status]
  19. $m[0]="Server is currently";
  20. $m[1]="";
  21. $mp[0]=strpos($in,$m[0]);
  22. $mp[1]=@strpos($in,$m[1]);
  23. $ml[0]=strlen($m[0]);
  24. $ml[1]=strlen($m[1]);
  25.  
  26. $tmp[1]=explode( " " , trim( substr( $in , $mp[0] + $ml[0] , 5 ) ) );
  27.  
  28. if( $tmp[1][0] == "up" )
  29. $dat[status] = "On";
  30. elseif( $tmp[1][0] == "down" )
  31. $dat[status] = "Off";
  32. else
  33. $dat[status] = "err";
  34.  
  35. if($dat[status]=="On")
  36. {
  37. // [radio]
  38. $m[0]="Stream Title:";
  39. $m[1]="Content Type:";
  40. $mp[0]=strpos($in,$m[0]);
  41. $mp[1]=strpos($in,$m[1]);
  42. $ml[0]=strlen($m[0]);
  43. $ml[1]=strlen($m[1]);
  44.  
  45. $tmp[1]=trim( substr( $in , $mp[0] + $ml[0] , $mp[1]-$mp[0]-$ml[1] ) );
  46.  
  47. if( $tmp[1] ) $dat[radio] = $tmp[1];
  48. else $dat[radio] = "err";
  49.  
  50. // [aim]
  51. $m[0]="Stream AIM:";
  52. $m[1]="Stream IRC:";
  53. $mp[0]=strpos($in,$m[0]);
  54. $mp[1]=strpos($in,$m[1]);
  55. $ml[0]=strlen($m[0]);
  56. $ml[1]=strlen($m[1]);
  57.  
  58. $tmp[1]=trim( substr( $in , $mp[0] + $ml[0] , $mp[1]-$mp[0]-$ml[1] ) );
  59.  
  60. if( $tmp[1] ) $dat[aim] = $tmp[1];
  61. else $dat[aim] = "err";
  62.  
  63. // [genre]
  64. $m[0]="Stream Genre:";
  65. $m[1]="Stream URL:";
  66. $mp[0]=strpos($in,$m[0]);
  67. $mp[1]=strpos($in,$m[1]);
  68. $ml[0]=strlen($m[0]);
  69. $ml[1]=strlen($m[1]);
  70.  
  71. $tmp[1]=trim( substr( $in , $mp[0] + $ml[0] , $mp[1]-$mp[0]-$ml[1]-2 ) );
  72.  
  73. if( $tmp[1] ) $dat[genre] = $tmp[1];
  74. else $dat[genre] = "err";
  75.  
  76. // [ile]
  77. $m[0]="kbps with";
  78. $m[1]="listeners";
  79. $mp[0]=strpos($in,$m[0]);
  80. $mp[1]=strpos($in,$m[1]);
  81. $ml[0]=strlen($m[0]);
  82. $ml[1]=strlen($m[1]);
  83.  
  84. $tmp[1]=explode( " " , trim( substr( $in , $mp[0] + $ml[0] , $mp[1]-$mp[0]-$ml[1]-2 ) ) );
  85.  
  86. if( $tmp[1] ) $dat[ile] = $tmp[1][0];
  87. else $dat[ile] = "err";
  88.  
  89. // [max]
  90. $m[0]="kbps with";
  91. $m[1]="listeners";
  92. $mp[0]=strpos($in,$m[0]);
  93. $mp[1]=strpos($in,$m[1]);
  94. $ml[0]=strlen($m[0]);
  95. $ml[1]=strlen($m[1]);
  96.  
  97. $tmp[1]=explode( " " , trim( substr( $in , $mp[0] + $ml[0] , $mp[1]-$mp[0]-$ml[1]-2 ) ) );
  98.  
  99. if( $tmp[1] ) $dat[max] = $tmp[1][2];
  100. else $dat[max] = "err";
  101.  
  102. // [peak]
  103. $m[0]="Listener Peak:";
  104. $m[1]="Average";
  105. $mp[0]=strpos($in,$m[0]);
  106. $mp[1]=strpos($in,$m[1]);
  107. $ml[0]=strlen($m[0]);
  108. $ml[1]=strlen($m[1]);
  109.  
  110. $tmp[1]=trim( substr( $in , $mp[0] + $ml[0] , $mp[1]-$mp[0]-$ml[1]-7) );
  111.  
  112. if( $tmp[1] ) $dat[peak] = $tmp[1];
  113. else $dat[peak] = "err";
  114.  
  115.  
  116. }
  117. }
  118. else
  119. {
  120. $dat=array();
  121. $dat[status]="err";
  122. }
  123.  
  124. $co = array('[status]','[radio]','[aim]','[genre]','[ile]','[max]','[peak]');
  125. $naco = array($dat[status],$dat[radio],$dat[aim],$dat[genre],$dat[ile],$dat[max],$dat[peak]);
  126. $sc[template1] = str_replace($co,$naco,$sc[template1]);
  127. $sc[template2] = str_replace($co,$naco,$sc[template2]);
  128.  
  129. $fp1 = @fsockopen($sc[host], $sc[port], &$errno, &$errstr, 10);
  130.  
  131. if (!$fp1) {
  132. $text = "Aktualnie nie nadajemy";
  133. } else {
  134.  
  135. fputs($fp1, "GET /7 HTTP/1.1\nUser-Agent:Mozilla\n\n");
  136.  
  137. for($i = 0; $i < 1; $i++) {
  138. if (feof($fp1)) break;
  139. $fp_data1 = fread($fp1, 31337);
  140. usleep(500000);
  141. }
  142.  
  143. $fp_data1 = ereg_replace("^.*<body>", "", $fp_data1);
  144. $fp_data1 = ereg_replace("</body>.*", "", $fp_data1);
  145.  
  146. list($current1, $status1, $peak1, $max1, $reported1, $bit1, $song1) = explode(",", $fp_data1, 7);
  147.  
  148. if ($status1 == "1")
  149. $text = "$song1";
  150. else
  151. $text = "Aktualnie nie nadajemy";
  152. }
  153.  
  154. // TU WSTAW ADRESY DO ZDJEC DJ'OW - WEDLUG WZORU
  155.  
  156. if ($dat[aim] == "numergg") $fotka = "fotka.jpg"; else
  157.  
  158.  
  159. $fotka = "brak.gif";
  160.  
  161. ?>
  162.  
  163. <table cellspacing="0" cellpadding="0" height="216" width="140" border="0" background ="tlo.gif">
  164. <tr><td width ="100%" height ="19" colspan ="2">
  165. <center><font size ="2" face ="Verdana" color ="black">
  166. Radio
  167. <br></font></center>
  168. </td></tr>
  169. <tr><td width ="80%" height ="15" valign ="top" colspan ="2">
  170. <center><font size ="1" face ="Arial">
  171. <A href ="http://www.omega.ovh.org" target ="_blank"><font color ="brown">www.omega.ovh.org</font></A>
  172. <br></font></center>
  173. </td></tr>
  174. <tr><td width ="100%" height ="15" colspan ="2">
  175. </td></tr>
  176. <tr><td width ="100%" height ="17" valign ="top" colspan ="2">
  177. <center><font size ="2" face ="Courier" color ="black">
  178. <MARQUEE width="80%" SCROLLAMOUNT="4" behavior ="scroll" onMouseOver='this.stop()' onMouseOut='this.start()'>
  179. <? echo $sc[template1]; ?>
  180. </MARQUEE>
  181. </font></center>
  182. </td></tr>
  183. <tr><td width ="100%" height ="15" colspan ="2">
  184. </td></tr>
  185. <tr><td width ="100%" height ="17" valign ="top" colspan ="2">
  186. <center><font size ="2" face ="Courier" color ="black">
  187. <MARQUEE width="80%" SCROLLAMOUNT="4" behavior ="scroll" onMouseOver='this.stop()' onMouseOut='this.start()'>
  188. <? echo $text; ?>
  189. </MARQUEE>
  190. </font></center>
  191. </td></tr>
  192. <tr><td width ="100%" height ="15" colspan ="2">
  193. </td></tr>
  194. <tr><td width ="100%" height ="17" valign ="top" colspan ="2">
  195. <center><font size ="2" face ="Courier" color ="black">
  196. <MARQUEE width="80%" SCROLLAMOUNT="4" behavior ="alternate" onMouseOver='this.stop()' onMouseOut='this.start()'>
  197. <? echo $sc[template2]; ?>
  198. </MARQUEE>
  199. </font></center>
  200. </td></tr>
  201. <tr><td width ="100%" height ="6" colspan ="2">
  202. </td></tr>
  203. <tr><td width ="65" height ="80" valign ="top">
  204. <? print "<a href='$sc[listen]'>Słuchaj nas</a>"; ?>
  205. <td width ="75" height ="80" valign ="top">
  206. <? print "<img src ='$fotka' width ='62' height ='70'>"; ?>
  207. <br clear ="all">
  208. </td></tr>
  209. </table>


Będę bardzo wdzięczny za jaką kolwiek pomoc.
jaslanin
taki błąd zwykle powodują pliki .htaccess, tam poszukaj przyczyny
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.