Parašė tofy· 2009 Rugp. 29 22:08:05
#1
Sveiki, taigi yra radijis panelės kodas. Ir kur yra "Eterije" norėčiau, kad auto pagal aim rodytu kas yra eterije .. KAip man tai padaryti ? kodas :
<?php
$station_name = "Radijas";
$refresh = "0"; // Page refresh time in seconds. Put 0 for no refresh
$timeout = "5"; // Number of seconds before connecton times out - a higher value will slow the page down if any servers are offline
// Note: dont include http://
// Main server: adresas kuriame laikai savo radija
$ip[1] = "88.222.9.74";
$port[1] = "8000";
$servers = count($ip);
?>
<?php
$i = "1";
while($i<=$servers)
{
$fp = @fsockopen($ip[$i],$port[$i],$errno,$errstr,$timeout);
if (!$fp)
{
$listeners[$i] = "0";
$msg[$i] = "<br><span class=\"red\">Serveris IŠJUNGTAS!</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\">Netransliuojama!</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\">";
} else {
echo "</div>\n";
echo " <br/>Eteryje: <b> </b>";
}
if ($stats[0] == $max[$i])
{
$msg[$i] .= "</span>";
}
$msg[$i] .= "\n <p><b>Daugiausia klausytojų-</b> $peak[$i]";
}
else
{
$listeners[$i] = "0";
$msg[$i] = " <span class=\"red\">Stotis IŠJUNGTA!</span>";
$error[$i] = "1";
}
}
}
$i++;
}
$total_listeners = array_sum($listeners) ;
print "<div id=\"blu\">\n <div style=\"text-align: right;\">\n <h8> <br> Unikalių klausytojų - <b>$total_listeners </b></h8>\n </div>\n</div>\n<div>\n <div>\n <p><b><div>\n <div style=\"text-align: right;\">Dabar groja:</b> </p>\n ";
$i = "1";
echo "<div>\n <div style=\"text-align: right;\"> $song[1]</p>\n";
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")
{
?>
<?php
}
$i++;
}
print "</div>\n";
echo "<a href='http://88.222.9.74:8000/listen.pls'><img src='".THEME."images/klausykis.jpg' border=0' alt='Winamp' /></a><br>" ;
closeside_panel();
?>