Hello, i am having a problem with my script. it's showing a BLANK screen. or should i say my entire
http://www.theslyshow.com/nowplaying.php is black, I recently switched HOSTS and it was working fine on the other host and this host it displays a black/blank page. a little lost why this is happening. ill post my codes below to see if somethings off-set?
( iv'e *** my passwords)
config
PHP Code:
<?php
/* MusicTicker - XML version 1.4.2 */
/* MAD props to Tom Pepper and Tag Loomis for all their help */
/* --------------------------------------------------------- */
/* SCXML configuration version 0.4.2 */
/* December 01 2004 01:05 EST */
//manditory config items
$host = "sc1.mystreamserver.com"; // host or ip of shoutcast server
$port = "8010"; // port of shoutcast server
$password = "****"; // password for shoutcast server
$maxsongs = "1"; // max number of songs to display (max is 20)
$rfrshrate = "5"; // reload rate of page
$timeat = "0"; // display starttime (0) or endtime (1)
//gui config items
$bodybgcolor = "#000000";
$bodytext = "#990000";
$bodylink = "#990000";
$bodyvlink = "#990000";
$bordercolor = "#990000";
$csscolor = "#708fbe";
$font = "Arial";
$align = "center";
$adjust = "0"; // change time to correct for server time (hour x 3600)
//master table color scheme
$mstrtext = "#000000";
$mstrbgcolor = "#f0f6fb";
//lead table color scheme
$tbl1bgcolor1 = "#000000";
$tbl1bgcolor2 = "#990000";
$tbl1text = "#FFFFFF";
//content table color scheme
$tbl2bgcolor1 = "#000000";
$tbl2bgcolor2 = "#000000";
$tbl2text1 = "#990000";
$tbl2text2 = "#990000";
//error screen color scheme
$errorbgcolor = "##000000";
$errortext = "#990000";
//On screen messages
$pgtitle = "Shoutcast Status Page";
$header = "Shoutcast Status Page";
$timezone = "EST (-0500 GMT)";
$dsperror1 = "we are off-air";
$error1 = "<html>\n<head>\n</head>\n<body bgcolor=\"$errorbgcolor\">\n<h2>\n<p align=\"center\"><font color=\"$errortext\">$errormsg1</p>\n<br>\n<p align=\"center\">$errormsg2</p>\n</font>\n</h2>\n</body>\n</html>";
$error2 = "<html>\n<head>\n</head>\n<body bgcolor=\"$errorbgcolor\">\n<h2>\n<p align=\"center\"><font color=\"$errortext\">$dsperror1</p>\n<br>\n<p align=\"center\">$dsperror2</p>\n</font>\n</h2>\n</body>\n</html>";
?>
scxml-obj
PHP Code:
<?php
/* MusicTicker - XML version 1.4.2 */
/* MAD props to Tom Pepper and Tag Loomis for all their help */
/* --------------------------------------------------------- */
/* SCXML object version 0.4.2 */
/* December 01 2004 01:05 EST */
error_reporting (E_ALL ^ E_NOTICE);
class SCXML {
var $host="sc1.mystreamserver.com"; // host or ip of shoutcast server
var $port="8010"; // port of shoutcast server
var $password="****"; // password for shoutcast server
/* DO NOT CHANGE ANYTHING FROM THIS POINT ON - THIS MEANS YOU !!! */
var $depth = 0;
var $lastelem= array();
var $xmlelem = array();
var $xmldata = array();
var $stackloc = 0;
var $parser;
function set_host($host) {
$this->host=$host;
}
function set_port($port) {
$this->port=$port;
}
function set_password($password) {
$this->password=$password;
}
function startElement($parser, $name, $attrs) {
$this->stackloc++;
$this->lastelem[$this->stackloc]=$name;
$this->depth++;
}
function endElement($parser, $name) {
unset($this->lastelem[$this->stackloc]);
$this->stackloc--;
}
function characterData($parser, $data) {
$data=trim($data);
if ($data) {
$this->xmlelem[$this->depth]=$this->lastelem[$this->stackloc];
$this->xmldata[$this->depth].=$data;
}
}
function retrieveXML() {
$rval=1;
$sp=@fsockopen($this->host,$this->port,&$errno,&$errstr,10);
if (!$sp) $rval=0;
else {
// request xml data from sc server
fputs($sp,"GET /admin.cgi?pass=$this->password&mode=viewxml HTTP/1.1\nUser-Agent:Mozilla\n\n");
// if request takes > 15s then exit
for($i=0; $i<30; $i++) {
if(feof($sp)) break; // exit if connection broken
$sp_data.=fread($sp,31337);
usleep(500000);
}
// strip useless data so all we have is raw sc server XML data
$sp_data=substr($sp_data, (strpos($sp_data, "\r\n\r\n")+4));
// plain xml parser
$this->parser = xml_parser_create();
xml_set_object($this->parser,&$this);
xml_set_element_handler($this->parser, "startElement", "endElement");
xml_set_character_data_handler($this->parser, "characterData");
if (!xml_parse($this->parser, $sp_data, 1)) {
$rval=-1;
}
xml_parser_free($this->parser);
}
return $rval;
}
function debugDump(){
reset($this->xmlelem);
while (list($key,$val) = each($this->xmlelem)) {
echo "$key. $val -> ".$this->xmldata[$key]."\n";
}
}
function fetchMatchingArray($tag){
reset($this->xmlelem);
$rval = array();
while (list($key,$val) = each($this->xmlelem)) {
if ($val==$tag) $rval[]=$this->xmldata[$key];
}
return $rval;
}
function fetchMatchingTag($tag){
reset($this->xmlelem);
$rval = "";
while (list($key,$val) = each($this->xmlelem)) {
if ($val==$tag) $rval=$this->xmldata[$key];
}
return $rval;
}
}
?>
scxml
PHP Code:
<?php
/* MusicTicker - XML version 1.4.2 */
/* MAD props to Tom Pepper and Tag Loomis for all their help */
/* --------------------------------------------------------- */
/* SCXML reference version 0.4.2 */
/* December 01 2004 01:05 EST */
error_reporting (E_ALL ^ E_NOTICE);
require "scxml-obj.php";
require "config.php";
$serv1 = new SCXML;
$serv1->set_host("sc1.mystreamserver.com");
$serv1->set_port("8010");
$serv1->set_password("****");
if (!$serv1->retrieveXML()) DIE ("$error1");
$con_dsp=$serv1->fetchMatchingTag("STREAMSTATUS");
if (!$con_dsp == "1") DIE ("$error2");
$trackpattern = "/^[0-9][0-9] /";
$trackreplace = "";
$title=$serv1->fetchMatchingTag("SERVERTITLE");
$song_title=$serv1->fetchMatchingTag("SONGTITLE");
$song_title = preg_replace($trackpattern, $trackreplace, $song_title);
$con_hostname=$serv1->fetchMatchingArray("HOSTNAME");
$con_listen=$serv1->fetchMatchingArray("CONNECTTIME");
$con_song=$serv1->fetchMatchingArray("TITLE");
$con_song_print=array_slice($con_song, 1, $maxsongs);
$con_time=$serv1->fetchMatchingArray("PLAYEDAT");
if (preg_match ("/^[0-9]{10}$/", $con_time[0])) {
for ($i=0; $i<count($con_time); $i++) {
$con_time[$i] = $con_time[$i] + $adjust;
$con_time[$i] = date('H:i:s', $con_time[$i]);
}
$playtime = $con_time;
}
else {
$playtime = $con_time;
}
if ($timeat == "0") {
$playat = array_shift ($playtime);
} else {
$playtime = $playtime;
}
echo "<html>\n";
echo "<META HTTP-EQUIV=\"REFRESH\" CONTENT=\"$rfrshrate\">\n";
echo "<head>\n";
echo " <title>$pgtitle</title>\n";
echo " <style type=\"text/css\">";
echo " .SongTitle { color: $csscolor;} A.SongTitle { color: $csscolor; } A:hover.SongTitle { color: $csscolor; }";
echo " </style>";
echo "</head>\n";
echo "\n";
echo "<body bgcolor=\"$bodybgcolor\" text=\"$bodytext\" link=\"$bodylink\" vlink=\"$bodyvlink\">\n";
echo "<p align=\"$align\">\n";
//Start of Master Table
echo " <table width=\"450\" border=\"0\" cellspacing=\"0\" cellpadding=\"2\" bordercolor=\"$bordercolor\">\n";
echo " <tr>\n";
echo " <td>\n";
echo " <center>\n";
echo " <b><font size=\"4\" face=\"$font\" color=\"$mstrtext\">$header</font></b>\n";
echo " </center>\n";
echo " <br>\n";
echo " <center>\n";
echo " \n";
echo " </center>\n";
echo " <p>\n";
//Start of Lead Table
echo " <table width=\"100%\" border=\"1\" cellspacing=\"0\" cellpadding=\"2\" bordercolor=\"$bordercolor\">\n";
echo " <tr>\n";
echo " <td bgcolor=\"$tbl1bgcolor1\">\n";
echo " <p align=center>\n";
echo " <b><font face=\"$font\" size=\"2\" color=\"$tbl1text\">Now Playing:</font></b>\n";
echo " </p>\n";
echo " </td>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td bgcolor=\"$tbl1bgcolor2\">\n";
echo " <p align=center>\n";
echo " <font face=\"$font\" size=\"2\"><a href=\"http://$host:$port/listen.pls\" class=\"SongTitle\">$song_title</a></font>\n";
echo " </p>\n";
echo " </td>\n";
echo " </tr>\n";
echo " </table>\n";
//End of Lead Table
echo " <p>\n";
echo " <br>\n";
echo " <center>\n";
echo " \n";
echo " </center>\n";
echo " </td>\n";
echo " </tr>\n";
echo " </table>\n";
//End of Master Table
echo "<br>\n";
//
echo "</p>\n";
echo "</body>\n";
echo "</html>";
?>
nowplaying.php
PHP Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title><?php
/* MusicTicker - XML version 1.4.2 */
/* MAD props to Tom Pepper and Tag Loomis for all their help */
/* --------------------------------------------------------- */
/* SCXML reference version 0.4.2 */
/* December 01 2004 01:05 EST */
error_reporting (E_ALL ^ E_NOTICE);
require "scxml-obj.php";
require "config.php";
$serv1 = new SCXML;
$serv1->set_host("$host");
$serv1->set_port("$port");
$serv1->set_password("$password");
if (!$serv1->retrieveXML()) DIE ("$error1");
$con_dsp=$serv1->fetchMatchingTag("STREAMSTATUS");
if (!$con_dsp == "1") DIE ("$error2");
$trackpattern = "/^[0-9][0-9] /";
$trackreplace = "";
$title=$serv1->fetchMatchingTag("SERVERTITLE");
$song_title=$serv1->fetchMatchingTag("SONGTITLE");
$song_title = preg_replace($trackpattern, $trackreplace, $song_title);
$con_hostname=$serv1->fetchMatchingArray("HOSTNAME");
$con_listen=$serv1->fetchMatchingArray("CONNECTTIME");
$con_song=$serv1->fetchMatchingArray("TITLE");
$con_song_print=array_slice($con_song, 1, $maxsongs);
$con_time=$serv1->fetchMatchingArray("PLAYEDAT");
if (preg_match ("/^[0-9]{10}$/", $con_time[0])) {
for ($i=0; $i<count($con_time); $i++) {
$con_time[$i] = $con_time[$i] + $adjust;
$con_time[$i] = date('H:i:s', $con_time[$i]);
}
$playtime = $con_time;
}
else {
$playtime = $con_time;
}
if ($timeat == "0") {
$playat = array_shift ($playtime);
} else {
$playtime = $playtime;
}
?>
<style type="text/css">
<!--
.style147 {font-size: 12px; font-family: Verdana, Arial, Helvetica, sans-serif; color: #FFFFFF; }
.style2 {font-family: Arial, Helvetica, sans-serif;
font-size: 14px;
font-weight: bold;
color: #FF0000;
}
body {
background-color: #000000;
}
-->
</style>
</head>
<body><span class="style23"><span class="style2">LIVE NOW </span><span class="style147">: <?php echo $song_title;
?></span></span>
</body>
</html>