metra52
New Member
- Messages
- 18
- Reaction score
- 0
- Points
- 0
Help me with this script. adress to this script http://onlydc.co.cc/status.php
this is my script check and fix it if you can
script should work as this http://fry-diz.ru/metra/status.php
Code:
<?php
//Configuration
$scdef = "NoN-StoP";
// ABOVE: Default station name to display when server or stream is down
$scip = "free.freeshoutcast.com"; // ip or url of shoutcast server (DO NOT ADD HTTP:// don't include the port)
$scport = "7950"; // port of shoutcast server
$scpass = "l14124"; // password to shoutcast server
$refreshrate = "200"; // Script/Page refresh time
$bgcolor = "#ffffff"; // page background colour, hex value, default = white, #ffffff
//End configuration
//*********** PUT YOUR INFO HERE ***********//
$scfp = fsockopen("$scip", $scport, &$errno, &$errstr, 30);
if(!$scfp) {
$scsuccs=1;
echo''.$scdef.' is<font color="red"> Offline</font>';
}
if($scsuccs!=1){
fputs($scfp,"GET /admin.cgi?pass=$scpass&mode=viewxml HTTP/1.0\r\nUser-Agent: SHOUTcast Song Status (Mozilla Compatible)\r\n\r\n");
while(!feof($scfp)) {
$page .= fgets($scfp, 1000);
}
######################################################################################################################
/////////////////////////part 1 \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
//define xml elements
$loop = array("STREAMSTATUS", "BITRATE", "SERVERTITLE", "CURRENTLISTENERS");
$y=0;
while($loop[$y]!=''){
$pageed = ereg_replace(".*<$loop[$y]>", "", $page);
$scphp = strtolower($loop[$y]);
$$scphp = ereg_replace("</$loop[$y]>.*", "", $pageed);
if($loop[$y]==SERVERGENRE || $loop[$y]==SERVERTITLE || $loop[$y]==SONGTITLE || $loop[$y]==SERVERTITLE)
$$scphp = urldecode($$scphp);
// uncomment the next line to see all variables
//echo'$'.$scphp.' = '.$$scphp.'<br>';
$y++;
}
//end intro xml elements
######################################################################################################################
//max listeners
include "max.php";
if ($currentlisteners>$max)
{
$txtout='<?php'."\r\n";
$txtout=$txtout. '$max=' .$currentlisteners. ";\r\n";
$txtout=$txtout."\r\n".'?>';
$fp = fopen ("max.php", "w");
fwrite($fp,$txtout);
fclose($fp);
$max=$currentlisteners;
}
######################################################################################################################
/////////////////////////part 2\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
//get song info and history
$pageed = ereg_replace(".*<SONGHISTORY>", "", $page);
$pageed = ereg_replace("<SONGHISTORY>.*", "", $pageed);
$songatime = explode("<SONG>", $pageed);
$r=1;
while($songatime[$r]!=""){
$t=$r-1;
$playedat[$t] = ereg_replace(".*<PLAYEDAT>", "", $songatime[$r]);
$playedat[$t] = ereg_replace("</PLAYEDAT>.*", "", $playedat[$t]);
$song[$t] = ereg_replace(".*<TITLE>", "", $songatime[$r]);
$song[$t] = ereg_replace("</TITLE>.*", "", $song[$t]);
$song[$t] = urldecode($song[$t]);
$dj[$t] = ereg_replace(".*<SERVERTITLE>", "", $page);
$dj[$t] = ereg_replace("</SERVERTITLE>.*", "", $pageed);
$r++;
}
//end song info
fclose($scfp);
}
//display stats
if($streamstatus == "1"){
//you may edit the html below, make sure to keep variable intact
$mas = explode("~", $servertitle);
//echo $mas[2];
$kart= explode("^",$servertitle);
$t = $mas[1];
if($kart[1] == 'Metra ~ 85015854')
{
echo'<img src="http://metra.gtproff.com/RJ_Metra.png" wigth="190" height="80" alt="">';
}
if($kart[1] == 'Nuggets ~ 5886724')
{
echo'<img src="http://metra.gtproff.com/RJ_nuggets.jpg" wigth="190" height="80" alt="">';
}
if($kart[1] == 'Lev ~ 3074854')
{
echo'<img src="http://metra.gtproff.com/RJ_Lev.jpg" wigth="190" height="80" alt="">';
}
if($kart[1] == 'Nabos ~ 3678944')
{
echo'<img src="http://metra.gtproff.com/rj_nabos.png" wigth="190" height="80" alt="">';
}
if($kart[1] == 'NoN Stop')
{
echo'<img src="http://metra.gtproff.com/non_stoprj.jpg" wigth="190" height="80" alt="">';
}
if($kart[1] == 'Konfetk@ ~ 588148781')
{
echo'<img src="http://metra.gtproff.com/RJ_k@nfetka.jpg" wigth="190" height="80" alt="">';
}
if($kart[1] == 'Ekstazi ~ 444079958')
{
echo'<img src="http://metra.gtproff.com/RJ_Ekstazi.jpg" wigth="190" height="80" alt="">';
}
//echo $icq[0];
echo'
';
}
if($streamstatus == "0")
{
//you may edit the html below, make sure to keep variable intact
echo' <img src="http://metra.gtproff.com/offline.jpg" wigth="190" height="80" alt="">';
}
?>
<html>
<meta http-equiv="refresh" content="60">
</html>
script should work as this http://fry-diz.ru/metra/status.php