StokeFM
21-08-2007, 12:21 PM
I have this code
<? session_start();
include('config_radio.php');
include'alert.php';
$scfp = fsockopen("$scip", $scport, &$errno, &$errstr, 30);
if(!$scfp) {
$scsuccs=1;
echo''.$scdef.' is Offline';
}
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
################################################## ################################################## ##################
################################################## ################################################## ##################
/////////////////////////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
echo'<html>
<head>
<meta http-equiv="Content-Language" content="en-gb">
<meta name="GENERATOR" content="Microsoft FrontPage 6.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<META HTTP-EQUIV="REFRESH" CONTENT="40;URL=last10.php">
<link rel=stylesheet href="" type="text/css">
<title>'.$scdef.'</title>
</head>
<body text="verdana" bgcolor="white">
<font face="Trebuchet MS">
<p align="center"><b>The Last Ten Songs Played on StokeFM</b></p>
</body>
<p align="center">
<table border="0" style="border-collapse: collapse" width="36%" id="table1" cellspacing="6" height="48">
<tr>
<td bgcolor="#33CCFF" style="border-style: dotted; border-width: 1px; padding-left: 4px; padding-right: 4px" bordercolor="#C0C0C0">
<p style="margin-top: 0; margin-bottom: 0" align="center">
<p style="margin-top: 0; margin-bottom: 0" align="center">
<p style="margin-top: 0; margin-bottom: 0" align="center">
<p style="margin-top: 0; margin-bottom: 0" align="center">
<font face="Trebuchet MS"><font size="5" color="#00000">
1.<? echo("$song[1]");?> <br/>
2.<? echo("$song[2]");?><br/>
3.<? echo("$song[3]");?><br/>
4.<? echo("$song[4]");?><br/>
5.<? echo("$song[5]");?><br/>
6.<? echo("$song[6]");?><br/>
7.<? echo("$song[7]");?><br/>
8.<? echo("$song[8]");?><br/>
9.<? echo("$song[9]");?><br/>
10.<? echo("$song[10]");?><br/>
</html></font>';
}
?>
It is sposed to display the last ten songs played
Anyone no whats up with? - it just dosent display it :S
<? session_start();
include('config_radio.php');
include'alert.php';
$scfp = fsockopen("$scip", $scport, &$errno, &$errstr, 30);
if(!$scfp) {
$scsuccs=1;
echo''.$scdef.' is Offline';
}
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
################################################## ################################################## ##################
################################################## ################################################## ##################
/////////////////////////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
echo'<html>
<head>
<meta http-equiv="Content-Language" content="en-gb">
<meta name="GENERATOR" content="Microsoft FrontPage 6.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<META HTTP-EQUIV="REFRESH" CONTENT="40;URL=last10.php">
<link rel=stylesheet href="" type="text/css">
<title>'.$scdef.'</title>
</head>
<body text="verdana" bgcolor="white">
<font face="Trebuchet MS">
<p align="center"><b>The Last Ten Songs Played on StokeFM</b></p>
</body>
<p align="center">
<table border="0" style="border-collapse: collapse" width="36%" id="table1" cellspacing="6" height="48">
<tr>
<td bgcolor="#33CCFF" style="border-style: dotted; border-width: 1px; padding-left: 4px; padding-right: 4px" bordercolor="#C0C0C0">
<p style="margin-top: 0; margin-bottom: 0" align="center">
<p style="margin-top: 0; margin-bottom: 0" align="center">
<p style="margin-top: 0; margin-bottom: 0" align="center">
<p style="margin-top: 0; margin-bottom: 0" align="center">
<font face="Trebuchet MS"><font size="5" color="#00000">
1.<? echo("$song[1]");?> <br/>
2.<? echo("$song[2]");?><br/>
3.<? echo("$song[3]");?><br/>
4.<? echo("$song[4]");?><br/>
5.<? echo("$song[5]");?><br/>
6.<? echo("$song[6]");?><br/>
7.<? echo("$song[7]");?><br/>
8.<? echo("$song[8]");?><br/>
9.<? echo("$song[9]");?><br/>
10.<? echo("$song[10]");?><br/>
</html></font>';
}
?>
It is sposed to display the last ten songs played
Anyone no whats up with? - it just dosent display it :S