[ M4ker @ 14.04.2009. 16:54 ] @
Pozdrav imam mali problem shoutcast skripta nece da mi radi na hostingu ali kod mene na localhostu radi... http://www.mojnis.com/shoutcaststats/shoutcaststats.php <---- ne radi pise da server nije ukljucen http://mojnis.no-ip.info/shoutcaststats/shoutcaststats.php <------ radi Na moj racunar imam instaliran ubuntu i lamp server a na hosting je debian valjda :S ako ima ikakve veze... sta moze da bude problem? Cod skripte: Code: <?php $station_name = "Mojnis radio 24h sa vama!"; $refresh = "60"; $timeout = "1"; $ip[1] = "93.186.171.3"; $port[1] = "2020"; $servers = count($ip); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <?php if ($refresh != "0") { print "<meta http-equiv=\"refresh\" content=\"$refresh\">\n"; } print "<title>$station_name</title>\n"; ?> <style type="text/css"> <!-- body { font-family: Arial, Helvetica, sans-serif; font-size: 12px; color: #333333; margin: 5px; } h1 { font-size: 22px; color: #000; margin: 2px; } h2 { font-size: 14px; color: #336666; margin: 2px; } p { margin: 5px; } a { color: #666699; text-decoration: none; } a:hover { color: #993333; } div.line { border-bottom: 1px dashed #000; height: 3px; font-size: 1px; margin-top: 0; } .small { font-size: 10px; } --> </style> </head> <body> <?php $i = "1"; while($i<=$servers) { $fp = @fsockopen($ip[$i],$port[$i],$errno,$errstr,$timeout); if (!$fp) { $listeners[$i] = "0"; $msg[$i] = "<span class=\"red\">ERROR [Server nije online]</span>"; $error[$i] = "1"; } else { fputs($fp, "GET /7.html HTTP/1.0\r\nUser-Agent: Mozilla\r\n\r\n"); while (!feof($fp)) { $info = fgets($fp); } $info = str_replace('<HTML><meta http-equiv="Pragma" content="no-cache"></head><body>', "", $info); $info = str_replace('</body></html>', "", $info); $stats = explode(',', $info); if (empty($stats[1]) ) { $listeners[$i] = "0"; $msg[$i] = "<span class=\"red\">ERROR [Nema dj-a online]</span>"; $error[$i] = "1"; } else { if ($stats[1] == "1") { $song[$i] = $stats[6]; $listeners[$i] = $stats[0]; $max[$i] = $stats[3]; $bitrate[$i] = $stats[5]; $peak[$i] = $stats[2]; if ($stats[0] == $max[$i]) { $msg[$i] .= "<span class=\"red\">"; } $msg[$i] .= "Server je pokrenut sa $bitrate[$i] kbps sa $listeners[$i] od $max[$i] slusalaca"; if ($stats[0] == $max[$i]) { $msg[$i] .= "</span>"; } $msg[$i] .= "\n <p><b>Maximum slusalaca online:</b> $peak[$i]"; } else { $listeners[$i] = "0"; $msg[$i] = " <span class=\"red\">ERROR [ne mogu da uzmem info]</span>"; $error[$i] = "1"; } } } $i++; } $total_listeners = array_sum($listeners) ; print "<div id=\"blu\">\n <div style=\"text-align: center;\">\n <h1>Trenutno $total_listeners slusalaca online</h1>\n </div>\n</div>\n<div>\n <div>\n <p><b>Trenutna pesma:</b> $song[1]</p>\n </div>\n</div>\n<div>\n"; $i = "1"; while($i<=$servers) { print " <div>\n"; if ($max[$i] > 0) { $percentage = round(($listeners[$i] / $max[$i] * 100)); $timesby = (300 / $max[$i]); $barlength = round(($listeners[$i] * "$timesby")); } if ($error[$i] != "1") { ?> <table width="400" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="25%" align="center"><b><a href="http://<?php print $ip[$i] . ":" . $port[$i]; ?>" target="_blank">Server <?php print $i ?></a></b> </td> <td width="75%" colspan="3" bgcolor="#eeeeee"><img src="<?php if ($percentage == "100") { print "red-"; } ?>bar.gif" width="<?php print $barlength ?>" height="12" alt="The server is at <?php print $percentage; ?>% capacity"></td> </tr> <tr> <td width="25%"> </td> <td width="25%">0%</td> <td width="25%" align="center">50%</td> <td width="25%" align="right">100%</td> </tr> </table> <?php } else { ?> <table width="400" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="25%" align="center"><b><a href="http://<?php print $ip[$i] . ":" . $port[$i]; ?>" target="_blank">Server <?php print $i ?></a></b> </td> <td width="75%" colspan="3" bgcolor="#eeeeee"> </td> </tr> <tr> <td width="25%"> </td> <td width="25%">0%</td> <td width="25%" align="center">50%</td> <td width="25%" align="right">100%</td> </tr> </table> <?php } print " <p><b>Status:</b> $msg[$i]</p>\n </div>\n <div class=\"line\"> </div>\n"; $i++; } print "</div>\n"; $time_difference = "0"; // BST: 1 GMT: 0 $time_difference = ($time_difference * 60 * 60); $time = date("h:ia", time() + $time_difference); $date = date("jS F, Y", time() + 0); print "<div>\n <div>\n <p><b>Uzivo radio statustika:</b> $date, $time</p>\n </div>\n</div>\n"; ?> </body> </html> |