Przedszkolak
Postów: 6
Data rejestracji: 12.01.2008 12:43
|
<?php
$serwers[1] = "shouted.pl:8004";
//$serwers[2] = "wpisujemy jeśli mamy drugi serwer do tego samego lub jeśli chcemy zliczyć wszystkie nasze kanały";
//$serwers[nr_serwera_z kolei_czyli_3] = "adres trzeciego serwera";
$ileserver = 1;
ini_set('user_agent','Mozilla/5.0');
$i=1;
while($i<=$ileserver){
$getstats = file_get_contents("http://".$serwers[$i]."/7.html");
$getstats = strip_tags($getstats);
list($current[$i],$status[$i],$peak[$i],$max[$i],$reported[$i],$bit[$i],$song[$i]) = explode(",",$getstats);
$sluchaczy = $sluchaczy + $current[$i];
$rekord = $rekord + $peak[$i];
$i++;
}
?>
<?php
$sc[czas] = 180;
$sc[host] = "shouted.pl"; //tutaj wpisujemy host radia
$sc[port] = 8004; //tutaj wpisujemy port na którym nadaje radio
$sc[template] = "[genre]";
$sc[template3] = "[dj]";
$sc[template2] = "[ile]";
?>
<?php
if($fp = fsockopen($sc[host], $sc[port]))
{
fputs($fp,"GET /index.html HTTP/1.0\r\nUser-Agent: XML Getter (Mozilla Compatible)\r\n\r\n");
fgets($fp);fgets($fp);fgets($fp);
while(!feof($fp)) $in.=strip_tags(fgets($fp));
fclose($fp);
# echo $in;
// [status]
$m[0]="Server is currently";
$m[1]="";
$mp[0]=strpos($in,$m[0]);
$mp[1]=@strpos($in,$m[1]);
$ml[0]=strlen($m[0]);
$ml[1]=strlen($m[1]);
$tmp[1]=explode( " " , trim( substr( $in , $mp[0] + $ml[0] , 5 ) ) );
if( $tmp[1][0] == "up" )
$dat[status] = "on";
elseif( $tmp[1][0] == "down" )
$dat[status] = "off";
else
$dat[status] = "err";
if($dat[status]=="on")
{
// [dj1]
$m[0]="Stream Title:";
$m[1]="Content Type:";
$mp[0]=strpos($in,$m[0]);
$mp[1]=strpos($in,$m[1]);
$ml[0]=strlen($m[0]);
$ml[1]=strlen($m[1]);
$tmp[1]=trim( substr( $in , $mp[0] + $ml[0] , $mp[1]-$mp[0]-$ml[1] ) );
if( $tmp[1] ) $dat[dj] = $tmp[1];
else $dat[dj] = "err";
// [gg]
$m[0]="Stream AIM:";
$m[1]="Stream IRC:";
$mp[0]=strpos($in,$m[0]);
$mp[1]=strpos($in,$m[1]);
$ml[0]=strlen($m[0]);
$ml[1]=strlen($m[1]);
$tmp[1]=trim( substr( $in , $mp[0] + $ml[0] , $mp[1]-$mp[0]-$ml[1] ) );
if( $tmp[1] ) $dat[gg] = $tmp[1];
else $dat[gg] = "err";
// [genre]
$m[0]="Stream Genre:";
$m[1]="Stream URL:";
$mp[0]=strpos($in,$m[0]);
$mp[1]=strpos($in,$m[1]);
$ml[0]=strlen($m[0]);
$ml[1]=strlen($m[1]);
$tmp[1]=trim( substr( $in , $mp[0] + $ml[0] , $mp[1]-$mp[0]-$ml[1]-2 ) );
if( $tmp[1] ) $dat[genre] = $tmp[1];
else $dat[genre] = "err";
// [ile]
$m[0]="kbps with";
$m[1]="listeners";
$mp[0]=strpos($in,$m[0]);
$mp[1]=strpos($in,$m[1]);
$ml[0]=strlen($m[0]);
$ml[1]=strlen($m[1]);
$tmp[1]=explode( " " , trim( substr( $in , $mp[0] + $ml[0] , $mp[1]-$mp[0]-$ml[1]-2 ) ) );
if( $tmp[1] ) $dat[ile] = $tmp[1][0];
else $dat[ile] = "err";
// [max]
$m[0]="kbps with";
$m[1]="listeners";
$mp[0]=strpos($in,$m[0]);
$mp[1]=strpos($in,$m[1]);
$ml[0]=strlen($m[0]);
$ml[1]=strlen($m[1]);
$tmp[1]=explode( " " , trim( substr( $in , $mp[0] + $ml[0] , $mp[1]-$mp[0]-$ml[1]-2 ) ) );
if( $tmp[1] ) $dat[max] = $tmp[1][2];
else $dat[max] = "err";
// [peak]
$m[0]="Listener Peak:";
$m[1]="Average";
$mp[0]=strpos($in,$m[0]);
$mp[1]=strpos($in,$m[1]);
$ml[0]=strlen($m[0]);
$ml[1]=strlen($m[1]);
$tmp[1]=trim( substr( $in , $mp[0] + $ml[0] , $mp[1]-$mp[0]-$ml[1]-7) );
if( $tmp[1] ) $dat[peak] = $tmp[1];
else $dat[peak] = "err";
}
}
else
{
$dat=array();
$dat[status]="err";
}
$co = array('[status]','[dj]','[gg]','[genre]','[ile]','[max]','[peak]');
$naco = array($dat[status],$dat[dj],$dat[gg],$dat[genre],$dat[ile],$dat[max],$dat[peak]);
$sc[template] = str_replace($co,$naco,$sc[template]);
$sc[template2] = str_replace($co,$naco,$sc[template2]);
$sc[template3] = str_replace($co,$naco,$sc[template3]);
//poniżej zamieszczamy dowolny układ graficzne
?>
<table border="0" cellpadding="0" cellspacing="0" width="703">
<tr>
<td><img src="shim.gif" width="340" height="1" border="0" alt=""></td>
<td><img src="shim.gif" width="35" height="1" border="0" alt=""></td>
<td><img src="shim.gif" width="328" height="1" border="0" alt=""></td>
<td><img src="shim.gif" width="1" height="1" border="0" alt=""></td>
</tr>
<tr>
<td valign="top" align="left" colspan="3" height="246"><img name="index.php_C1_R1" src="images/index.php_C1_R1.jpg" width="703" height="246" border="0" alt=""></td>
<td width="1" height="246"><img src="shim.gif" width="1" height="246" border="0" alt=""></td>
</tr>
<tr>
<td valign="top" align="left" rowspan="3" width="340"><img name="index.php_C1_R2" src="images/index.php_C1_R2.jpg" width="340" height="54" border="0" alt=""></td>
<td valign="top" align="left" width="35" height="6"><img name="index.php_C2_R2" src="images/index.php_C2_R2.jpg" width="35" height="6" border="0" alt=""></td>
<td valign="top" align="left" rowspan="3" width="328"><img name="index.php_C3_R2" src="images/index.php_C3_R2.jpg" width="328" height="54" border="0" alt=""></td>
<td width="1" height="6"><img src="images/shim.gif" width="1" height="6" border="0" alt=""></td>
</tr>
<tr>
<td background="images/index.php_C2_R3.jpg" valign="top" align="left" width="35" height="18">
<center>
<font size="2.5"><? echo $sc[template2]; ?>
</font>
<center>
</td>
<td width="1" height="18"><img src="images/shim.gif" width="1" height="18" border="0" alt=""></td>
</tr>
<tr>
<td valign="top" align="left" width="35" height="30"><img name="index.php_C2_R4" src="images/index.php_C2_R4.jpg" width="35" height="30" border="0" alt=""></td>
<td width="1" height="30"><img src="images/shim.gif" width="1" height="30" border="0" alt=""></td>
</tr>
</table><?
</body>
Widze że nikt jakoś nie chce mi pomóc ;)
Edytowane przez mati010 dnia 19.07.2008 19:55:49
|
Zaawansowany
Postów: 1656 Pomógł: 42
Data rejestracji: 28.04.2005 20:28
|
Powinno działać, tzn mam taką nadzieje.
Obraki z katalogu images (tego skryptu) należy wrzucić do katalogu images fusiona.
Zalecam kopię pliku theme.php.
function render_header($header_content) {
global $theme_width;
echo "<table align='center' cellspacing='0' cellpadding='0' width='$theme_width' class='outer-border'>
<tr><td>";
$serwers[1] = "shouted.pl:8004";
//$serwers[2] = "wpisujemy jeśli mamy drugi serwer do tego samego lub jeśli chcemy zliczyć wszystkie nasze kanały";
//$serwers[nr_serwera_z kolei_czyli_3] = "adres trzeciego serwera";
$ileserver = 1;
ini_set('user_agent','Mozilla/5.0');
$i=1;
while($i<=$ileserver){
$getstats = file_get_contents("http://".$serwers[$i]."/7.html");
$getstats = strip_tags($getstats);
list($current[$i],$status[$i],$peak[$i],$max[$i],$reported[$i],$bit[$i],$song[$i]) = explode(",",$getstats);
$sluchaczy = $sluchaczy + $current[$i];
$rekord = $rekord + $peak[$i];
$i++;
}
$sc[czas] = 180;
$sc[host] = "shouted.pl"; //tutaj wpisujemy host radia
$sc[port] = 8004; //tutaj wpisujemy port na którym nadaje radio
$sc[template] = "[genre]";
$sc[template3] = "[dj]";
$sc[template2] = "[ile]";
if($fp = fsockopen($sc[host], $sc[port]))
{
fputs($fp,"GET /index.html HTTP/1.0\r\nUser-Agent: XML Getter (Mozilla Compatible)\r\n\r\n");
fgets($fp);fgets($fp);fgets($fp);
while(!feof($fp)) $in.=strip_tags(fgets($fp));
fclose($fp);
# echo $in;
// [status]
$m[0]="Server is currently";
$m[1]="";
$mp[0]=strpos($in,$m[0]);
$mp[1]=@strpos($in,$m[1]);
$ml[0]=strlen($m[0]);
$ml[1]=strlen($m[1]);
$tmp[1]=explode( " " , trim( substr( $in , $mp[0] + $ml[0] , 5 ) ) );
if( $tmp[1][0] == "up" )
$dat[status] = "on";
elseif( $tmp[1][0] == "down" )
$dat[status] = "off";
else
$dat[status] = "err";
if($dat[status]=="on")
{
// [dj1]
$m[0]="Stream Title:";
$m[1]="Content Type:";
$mp[0]=strpos($in,$m[0]);
$mp[1]=strpos($in,$m[1]);
$ml[0]=strlen($m[0]);
$ml[1]=strlen($m[1]);
$tmp[1]=trim( substr( $in , $mp[0] + $ml[0] , $mp[1]-$mp[0]-$ml[1] ) );
if( $tmp[1] ) $dat[dj] = $tmp[1];
else $dat[dj] = "err";
// [gg]
$m[0]="Stream AIM:";
$m[1]="Stream IRC:";
$mp[0]=strpos($in,$m[0]);
$mp[1]=strpos($in,$m[1]);
$ml[0]=strlen($m[0]);
$ml[1]=strlen($m[1]);
$tmp[1]=trim( substr( $in , $mp[0] + $ml[0] , $mp[1]-$mp[0]-$ml[1] ) );
if( $tmp[1] ) $dat[gg] = $tmp[1];
else $dat[gg] = "err";
// [genre]
$m[0]="Stream Genre:";
$m[1]="Stream URL:";
$mp[0]=strpos($in,$m[0]);
$mp[1]=strpos($in,$m[1]);
$ml[0]=strlen($m[0]);
$ml[1]=strlen($m[1]);
$tmp[1]=trim( substr( $in , $mp[0] + $ml[0] , $mp[1]-$mp[0]-$ml[1]-2 ) );
if( $tmp[1] ) $dat[genre] = $tmp[1];
else $dat[genre] = "err";
// [ile]
$m[0]="kbps with";
$m[1]="listeners";
$mp[0]=strpos($in,$m[0]);
$mp[1]=strpos($in,$m[1]);
$ml[0]=strlen($m[0]);
$ml[1]=strlen($m[1]);
$tmp[1]=explode( " " , trim( substr( $in , $mp[0] + $ml[0] , $mp[1]-$mp[0]-$ml[1]-2 ) ) );
if( $tmp[1] ) $dat[ile] = $tmp[1][0];
else $dat[ile] = "err";
// [max]
$m[0]="kbps with";
$m[1]="listeners";
$mp[0]=strpos($in,$m[0]);
$mp[1]=strpos($in,$m[1]);
$ml[0]=strlen($m[0]);
$ml[1]=strlen($m[1]);
$tmp[1]=explode( " " , trim( substr( $in , $mp[0] + $ml[0] , $mp[1]-$mp[0]-$ml[1]-2 ) ) );
if( $tmp[1] ) $dat[max] = $tmp[1][2];
else $dat[max] = "err";
// [peak]
$m[0]="Listener Peak:";
$m[1]="Average";
$mp[0]=strpos($in,$m[0]);
$mp[1]=strpos($in,$m[1]);
$ml[0]=strlen($m[0]);
$ml[1]=strlen($m[1]);
$tmp[1]=trim( substr( $in , $mp[0] + $ml[0] , $mp[1]-$mp[0]-$ml[1]-7) );
if( $tmp[1] ) $dat[peak] = $tmp[1];
else $dat[peak] = "err";
}
}
else
{
$dat=array();
$dat[status]="err";
}
$co = array('[status]','[dj]','[gg]','[genre]','[ile]','[max]','[peak]');
$naco = array($dat[status],$dat[dj],$dat[gg],$dat[genre],$dat[ile],$dat[max],$dat[peak]);
$sc[template] = str_replace($co,$naco,$sc[template]);
$sc[template2] = str_replace($co,$naco,$sc[template2]);
$sc[template3] = str_replace($co,$naco,$sc[template3]);
//poniżej zamieszczamy dowolny układ graficzne
echo "
<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"703\" align=\"center\">
<tr>
<td><img src=\"shim.gif\" width=\"340\" height=\"1\" border=\"0\" alt=\"\"></td>
<td><img src=\"shim.gif\" width=\"35\" height=\"1\" border=\"0\" alt=\"\"></td>
<td><img src=\"shim.gif\" width=\"328\" height=\"1\" border=\"0\" alt=\"\"></td>
<td><img src=\"shim.gif\" width=\"1\" height=\"1\" border=\"0\" alt=\"\"></td>
</tr>
<tr>
<td valign=\"top\" align=\"left\" colspan=\"3\" height=\"246\"><img name=\"index.php_C1_R1\" src=\"".BASEDIR."images/index.php_C1_R1.jpg\" width=\"703\" height=\"246\" border=\"0\" alt=\"\"></td>
<td width=\"1\" height=\"246\"><img src=\"shim.gif\" width=\"1\" height=\"246\" border=\"0\" alt=\"\"></td>
</tr>
<tr>
<td valign=\"top\" align=\"left\" rowspan=\"3\" width=\"340\"><img name=\"index.php_C1_R2\" src=\"".BASEDIR."images/index.php_C1_R2.jpg\" width=\"340\" height=\"54\" border=\"0\" alt=\"\"></td>
<td valign=\"top\" align=\"left\" width=\"35\" height=\"6\"><img name=\"index.php_C2_R2\" src=\"".BASEDIR."images/index.php_C2_R2.jpg\" width=\"35\" height=\"6\" border=\"0\" alt=\"\"></td>
<td valign=\"top\" align=\"left\" rowspan=\"3\" width=\"328\"><img name=\"index.php_C3_R2\" src=\"".BASEDIR."images/index.php_C3_R2.jpg\" width=\"328\" height=\"54\" border=\"0\" alt=\"\"></td>
<td width=\"1\" height=\"6\"><img src=\"".BASEDIR."images/shim.gif\" width=\"1\" height=\"6\" border=\"0\" alt=\"\"></td>
</tr>
<tr>
<td background=\"".BASEDIR."images/index.php_C2_R3.jpg\" valign=\"top\" align=\"left\" width=\"35\" height=\"18\">
<center>
<font size=\"2.5\">";
echo $sc[template2];
echo "</font>
<center>
</td>
<td width=\"1\" height=\"18\"><img src=\"".BASEDIR."images/shim.gif\" width=\"1\" height=\"18\" border=\"0\" alt=\"\"></td>
</tr>
<tr>
<td valign=\"top\" align=\"left\" width=\"35\" height=\"30\"><img name=\"index.php_C2_R4\" src=\"".BASEDIR."images/index.php_C2_R4.jpg\" width=\"35\" height=\"30\" border=\"0\" alt=\"\"></td>
<td width=\"1\" height=\"30\"><img src=\"".BASEDIR."images/shim.gif\" width=\"1\" height=\"30\" border=\"0\" alt=\"\"></td>
</tr>
</table>";
echo "<table align='center' cellpadding='0' cellspacing='0' width='100%'>\n<tr>
<td align='center' class='sub-header'>".showsublinks("·","white")."</td>
</td></tr></table>\n";
echo "<table cellpadding='0' cellspacing='0' width='100%'>\n<tr>\n";
}
Edytowane przez Grzes dnia 20.07.2008 01:19:09
Często najmądrzejszą odpowiedzią jest milczenie
|