Przedszkolak
Postów: 2
Data rejestracji: 08.08.2006 21:29
|
Witam
Zaczynam zabawe z PHPFusion i PHP wiec prosze o pomoc
chce zamontować taki skrypt:
openside("Statystyki");
echo'<center>';
$sc[czas] = 180;
$sc[host] = "212.199.164.10";
$sc[port] = 1920;
$sc[template1] = "<b>[radio]</b>";
$sc[template2] = "<b>[aim]</b>";
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);
// [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")
{
// [radio]
$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[radio] = $tmp[1];
else $dat[radio] = "err";
// [aim]
$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[aim] = $tmp[1];
else $dat[aim] = "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]','[radio]','[aim]','[genre]','[ile]','[max]','[peak]');
$naco = array($dat[status],$dat[radio],$dat[aim],$dat[genre],$dat[ile],$dat[max],$dat[peak]);
$sc[template1] = str_replace($co,$naco,$sc[template1]);
$sc[template2] = str_replace($co,$naco,$sc[template2]);
$fp1 = @fsockopen($sc[host], $sc[port], &$errno, &$errstr, 10);
if (!$fp1) {
$text = "Aktualnie nie nadajemy";
} else {
fputs($fp1, "GET /7 HTTP/1.1\nUser-Agent:Mozilla\n\n");
for($i = 0; $i < 1; $i++) {
if (feof($fp1)) break;
$fp_data1 = fread($fp1, 31337);
usleep(500000);
}
$fp_data1 = ereg_replace("^.*<body>", "", $fp_data1);
$fp_data1 = ereg_replace("</body>.*", "", $fp_data1);
list($current1, $status1, $peak1, $max1, $reported1, $bit1, $song1) = explode(",", $fp_data1, 7);
if ($status1 == "1")
$text = "$song1";
else
$text = "Aktualnie nie nadajemy";
}
// TU WSTAW ADRESY DO ZDJEC DJ'OW - WEDLUG WZORU
if ($dat[aim] == "AutoPilot") $fotka = "pilot.jpg"; else
$fotka = "brak.gif";
?>
<table cellspacing="0" cellpadding="0" height="216" width="140" border="0" background ="tlo.gif">
<tr><td width ="100%" height ="19" colspan ="2">
<center><font size ="2" face ="Verdana" color ="black"><b>
Stacja
</b><br></font></center>
</td></tr>
<tr><td width ="80%" height ="15" valign ="top" colspan ="2">
<center><font size ="1" face ="Arial"><b>
<A href ="http://www.stacja.pl" target ="_blank"><font color ="brown">http://www.stacja.pl</font></A>
</b><br></font></center>
</td></tr>
<tr><td width ="100%" height ="15" colspan ="2">
</td></tr>
<tr><td width ="100%" height ="17" valign ="top" colspan ="2">
<center><font size ="2" face ="Courier" color ="black"><b>
<MARQUEE width="80%" SCROLLAMOUNT="4" behavior ="scroll" onMouseOver='this.stop()' onMouseOut='this.start()'>
<? echo $sc[template1]; ?>
</MARQUEE>
</font></center>
</td></tr>
<tr><td width ="100%" height ="15" colspan ="2">
</td></tr>
<tr><td width ="100%" height ="17" valign ="top" colspan ="2">
<center><font size ="2" face ="Courier" color ="black"><b>
<MARQUEE width="80%" SCROLLAMOUNT="4" behavior ="scroll" onMouseOver='this.stop()' onMouseOut='this.start()'>
<? echo $text; ?>
</MARQUEE>
</font></center>
</td></tr>
<tr><td width ="100%" height ="15" colspan ="2">
</td></tr>
<tr><td width ="100%" height ="17" valign ="top" colspan ="2">
<center><font size ="2" face ="Courier" color ="black"><b>
<MARQUEE width="80%" SCROLLAMOUNT="4" behavior ="alternate" onMouseOver='this.stop()' onMouseOut='this.start()'>
<? echo $sc[template2]; ?>
</MARQUEE>
</font></center>
</td></tr>
<tr><td width ="100%" height ="6" colspan ="2">
</td></tr>
<tr><td width ="65" height ="80" valign ="top">
<a href ="http://212.199.164.100:1920/listen.pls"><img src ="separ.gif" width ="65" height ="70" border ="0"></a><br clear ="all">
<td width ="75" height ="80" valign ="top">
<? print "<img src ='$fotka' width ='62' height ='70'>"; ?>
<br clear ="all">
</td></tr>
</table>';
closeside();
wszystko działa lecz zakonczenie pliku jest chyba nie takie bo dolna kolumna przeskakuje na bok i strona zmienia ksztalt.
Bradzo prosze o pomoc . THX :D |
Bywalec
Postów: 538
Data rejestracji: 05.06.2005 08:27
|
openside("Statystyki");
echo'<center>';
$sc[czas] = 180;
$sc[host] = "212.199.164.10";
$sc[port] = 1920;
$sc[template1] = "<b>[radio]</b>";
$sc[template2] = "<b>[aim]</b>";
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);
// [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")
{
// [radio]
$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[radio] = $tmp[1];
else $dat[radio] = "err";
// [aim]
$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[aim] = $tmp[1];
else $dat[aim] = "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]','[radio]','[aim]','[genre]','[ile]','[max]','[peak]');
$naco = array($dat[status],$dat[radio],$dat[aim],$dat[genre],$dat[ile],$dat[max],$dat[peak]);
$sc[template1] = str_replace($co,$naco,$sc[template1]);
$sc[template2] = str_replace($co,$naco,$sc[template2]);
$fp1 = @fsockopen($sc[host], $sc[port], &$errno, &$errstr, 10);
if (!$fp1) {
$text = "Aktualnie nie nadajemy";
} else {
fputs($fp1, "GET /7 HTTP/1.1\nUser-Agent:Mozilla\n\n");
for($i = 0; $i < 1; $i++) {
if (feof($fp1)) break;
$fp_data1 = fread($fp1, 31337);
usleep(500000);
}
$fp_data1 = ereg_replace("^.*<body>", "", $fp_data1);
$fp_data1 = ereg_replace("</body>.*", "", $fp_data1);
list($current1, $status1, $peak1, $max1, $reported1, $bit1, $song1) = explode(",", $fp_data1, 7);
if ($status1 == "1")
$text = "$song1";
else
$text = "Aktualnie nie nadajemy";
}
// TU WSTAW ADRESY DO ZDJEC DJ'OW - WEDLUG WZORU
if ($dat[aim] == "AutoPilot") $fotka = "pilot.jpg"; else
$fotka = "brak.gif";
?>
<table cellspacing="0" cellpadding="0" height="216" width="140" border="0" background ="tlo.gif">
<tr><td width ="100%" height ="19" colspan ="2">
<center><font size ="2" face ="Verdana" color ="black"><b>
Stacja
</b><br></font></center>
</td></tr>
<tr><td width ="80%" height ="15" valign ="top" colspan ="2">
<center><font size ="1" face ="Arial"><b>
<A href ="http://www.stacja.pl" target ="_blank"><font color ="brown">http://www.stacja.pl</font></A>
</b><br></font></center>
</td></tr>
<tr><td width ="100%" height ="15" colspan ="2">
</td></tr>
<tr><td width ="100%" height ="17" valign ="top" colspan ="2">
<center><font size ="2" face ="Courier" color ="black"><b>
<MARQUEE width="80%" SCROLLAMOUNT="4" behavior ="scroll" onMouseOver='this.stop()' onMouseOut='this.start()'>
<? echo $sc[template1]; ?>
</MARQUEE>
</font></center>
</td></tr>
<tr><td width ="100%" height ="15" colspan ="2">
</td></tr>
<tr><td width ="100%" height ="17" valign ="top" colspan ="2">
<center><font size ="2" face ="Courier" color ="black"><b>
<MARQUEE width="80%" SCROLLAMOUNT="4" behavior ="scroll" onMouseOver='this.stop()' onMouseOut='this.start()'>
<? echo $text; ?>
</MARQUEE>
</font></center>
</td></tr>
<tr><td width ="100%" height ="15" colspan ="2">
</td></tr>
<tr><td width ="100%" height ="17" valign ="top" colspan ="2">
<center><font size ="2" face ="Courier" color ="black"><b>
<MARQUEE width="80%" SCROLLAMOUNT="4" behavior ="alternate" onMouseOver='this.stop()' onMouseOut='this.start()'>
<? echo $sc[template2]; ?>
</MARQUEE>
</font></center>
</td></tr>
<tr><td width ="100%" height ="6" colspan ="2">
</td></tr>
<tr><td width ="65" height ="80" valign ="top">
<a href ="http://212.199.164.100:1920/listen.pls"><img src ="separ.gif" width ="65" height ="70" border ="0"></a><br clear ="all">
<td width ="75" height ="80" valign ="top">
<? print "<img src ='$fotka' width ='62' height ='70'>"; ?>
<br clear ="all">
</td></tr>
</table>';
<?
closeside();
Zamknąłeś PHP i dałes closeside();
Zapraszam na motoklimat.pl - Baza wiedzy o samochodach, modele, spalanie, specyfikacje.
|