Hi guys, I have a problem that is most likely a very simple fix, but with my very limited knowledge I'm at a loss on how to fix it. Could anyone help please.
I have this code in a Static HTML widget and it works just fine.
HTML Code:
<a href="url_removed_by_me" onclick="window.open('url_removed_by_me','popup','width=400,height=200,scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0'); return false">Start JukeBox</a>
Now then, I also have another PHP Direct Exec widget, with the following code..
PHP Code:
ob_start();
include("radio_stats.php");
echo "<br />\n";
$output .= ob_get_contents();
ob_end_clean();
The output from radio_stats.php is displayed ok and I'm almost there. Here's my problem, I want to add the first section of code to the radio_stats.php to give me a link that opens the page in a sized popup.
Here's my radio_stats.php
PHP Code:
<?php
// Shoutcast Server Stats
// Parses shoutcasts xml to make an effective stats thing for any website
// Add-On MAXLISTNERS insead of the / 10 MAXLISTENERS which was set, and the BITRATE add-on.
// Online and Offline graphics, and add-on code.
// Better HTML Script.
// Do Not Try To Edit This Only Unless You Know What You're Doing!!!!!!!
include('config_radio.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", "MAXLISTENERS", "BITRATE");
$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-Type" content="text/html; charset=windows-1252">
<link rel=stylesheet href="" type="text/css">
<title>'.$scdef.'</title>
</head>
<body text="" bgcolor="">
<p align="center"><center>
<img src="online.jpg"><br>
'.$servertitle.'<br>
<br>
<b>Listeners:</b> '.$currentlisteners.' / '.$maxlisteners.' <b> Bitrate:</b> '.$bitrate.'kbps<br>
<b>Current Song:</b> '.$song[0].'</p><b>
<br>
<a href="streams.html" target="_blank">Listen Now</a>
</p>
</body>
</html>';
}
if($streamstatus == "0")
{
//you may edit the html below, make sure to keep variable intact
echo'
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<link rel=stylesheet href="" type="text/css">
<title>Radio Server Is Offline</title>
</head>
<body text="" bgcolor="">
<center>
<img src="offline.jpg">
</body>
</html>';
}
?>
OK, so, the majority of the above code is probably not important, I simply want to use the method shown in the first code snipet to replace the :-
'<a href="streams.html" target="_blank">Listen Now</a>'
in the above code snipet. So , basically, when the shoutcast server is online, I display a link to open the player in a popup.
So far, when I add the code, I get the error :-
Code:
Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /url/removed/by/me/radio_stats.php on line 87
Many thanks for reading, here's hoping...
B16MCC.