Okay this is going to be a bit of an ask, but i need someone to debug my code. I've spent hours on end trying to work this out, hours searching countless forums for help. I need someone who is PHP, MySQL and ShoutCAST literate to help me!!
Okay here it goes. I have this radio station, and it has lots of shows about video games...etc. Now the site gathers information from the Stations shoutcast xml feed and a MySQL database produced from my broadcast software. Now The site reads the xml feeds to determine which show is playing and then changes the 'Now Playing' image to the according show.
The MySQL details reads the database and displays what songs are playing and what songs will be played next (this is because the xml output of the broadcast software is overwritten with the name of the show instead of the currently playing song).
So heres my code...
<<<<INDEX.php>>>>
<?php
require($_SERVER['DOCUMENT_ROOT']."/_header.php");
?>
<style type="text/css">
pre {
font-family: Default Font;
}
.content {
font-family: "Lucida Grande";
}
.content_italic {
font-style: italic;
font-size: 9px;
}
</style>
<?php
$hideright=false;
$title='Radio';
// Shoutcast PHP scripts
require_once('shoutcast_class.php');
$ip= 'mail.newcreationgroup.com.au';
$port = 8000;
{
$radio = new Radio('mail.newcreationgroup.com.au:8000');
$display_array = array('Stream Title');
$disp_serv_stats = array("Server Status");
$disp_song = array("Current Song");
$data_array = $radio->getServerInfo($disp_serv_stats);
$data_array2 = $radio->getServerInfo($disp_song);
// ########################################################
// SAM PHP scripts
if (isset($data_array[0]) && $data_array[0] == 'Hyrule.net Digital (Standard)')
{
// Default array... der.
$listeners = array();
/*
// Calling down the configuration file.
require_once('db/config.php');
// Grabbing the contents.
$db->open("SELECT songlist.*, historylist.listeners as listeners, historylist.requestID as requestID, historylist.date_played as starttime FROM historylist,songlist WHERE (historylist.songID = songlist.ID) AND (songlist.songtype='S' OR songlist.songtype='I' OR songlist.songtype='A' OR songlist.songtype='V' OR songlist.songtype='C') ORDER BY historylist.date_played DESC",1);
// Going by each row into a local expression...
$history = $db->rows();
// Reset...
reset($history);
// Grabbing the contents for the query list.
$db->open("SELECT songlist.*, queuelist.requestID as requestID FROM queuelist, songlist WHERE (queuelist.songID = songlist.ID) AND (songlist.songtype='S' OR songlist.songtype='I' OR songlist.songtype='A' OR songlist.songtype='V' OR songlist.songtype='C') AND (songlist.artist <> '') ORDER BY queuelist.sortID ASC",1);
// Same deal...
$queue = $db->rows();
// Reset...
reset($queue);
//### Calculate the bezt time to refresh the webpage in order to show new updated song information - not used
//==================================================================================================
list($key, $song) = each($history);
$listeners = $song['listeners'];
$curtime = time()-9200;
$starttime = strtotime($song['date_played']);
$secsRemain = (round($song['duration'] / 1000)-($curtime-$starttime));
//Set refesh interval
if ($timeleft > 0)
$timeout = $timeleft;
else
$timeout = 90;
if (($timeout > 180) || ($timeout == 0))
$timeout = 180;
if ($timeout < 10)
$timeout = 12;
//==================================================================================================
}
*/
//Detects what show is playing
if ($data_array2 == 'The Main Event - Live Show') {
$show = "images/playlive_mainevent.png";
$showinfo = "false";
}
if ($data_array2 == 'The Windmill Hut - Live Show') {
$show = "images/playlive_windmillhut.png";
$showinfo = "false";
}
if ($data_array2 == 'DJ Sam - Kingdom Hearts') {
$show = "images/playlive_kingdomhearts.png";
$showinfo = "false";
}
if ($data_array2 == 'Mario Mixup Hour') {
$show = "images/playlive_mario.png.png";
$showinfo = "false";
}
if ($data_array2 == 'The Nitelife') {
$show = "images/playlive_nitelife.png";
$showinfo = "true";
}
if ($data_array2 == 'The Best of ZREO') {
$show = "images/playlive_zreo.png";
$showinfo = "true";
}
if ($data_array2 == 'The Blank Report') {
$show = "images/playlive_zreo.png";
$showinfo = "false";
}
if ($data_array2 == 'Ten Swords, Blue Vampires, etc') {
$show = "images/playlive_tenswords.png";
$showinfo = "false";
}
else {
$show = "images/playlive_djsam.png";
$showinfo = "true";
}
?>
<script src="scriptaculous.js" type="text/javascript"></script>
<script src="prototype.js" type="text/javascript"></script>
<? if ( $data_array["0"] == "Server is currently up and public." ) { $status = "online"; } else { $status = "offline"; } ?>
<div id="content" style="width: 600px;">
<? if ($status == "online") { ?>
Okay here it goes. I have this radio station, and it has lots of shows about video games...etc. Now the site gathers information from the Stations shoutcast xml feed and a MySQL database produced from my broadcast software. Now The site reads the xml feeds to determine which show is playing and then changes the 'Now Playing' image to the according show.
The MySQL details reads the database and displays what songs are playing and what songs will be played next (this is because the xml output of the broadcast software is overwritten with the name of the show instead of the currently playing song).
So heres my code...
<<<<INDEX.php>>>>
<?php
require($_SERVER['DOCUMENT_ROOT']."/_header.php");
?>
<style type="text/css">
pre {
font-family: Default Font;
}
.content {
font-family: "Lucida Grande";
}
.content_italic {
font-style: italic;
font-size: 9px;
}
</style>
<?php
$hideright=false;
$title='Radio';
// Shoutcast PHP scripts
require_once('shoutcast_class.php');
$ip= 'mail.newcreationgroup.com.au';
$port = 8000;
{
$radio = new Radio('mail.newcreationgroup.com.au:8000');
$display_array = array('Stream Title');
$disp_serv_stats = array("Server Status");
$disp_song = array("Current Song");
$data_array = $radio->getServerInfo($disp_serv_stats);
$data_array2 = $radio->getServerInfo($disp_song);
// ########################################################
// SAM PHP scripts
if (isset($data_array[0]) && $data_array[0] == 'Hyrule.net Digital (Standard)')
{
// Default array... der.
$listeners = array();
/*
// Calling down the configuration file.
require_once('db/config.php');
// Grabbing the contents.
$db->open("SELECT songlist.*, historylist.listeners as listeners, historylist.requestID as requestID, historylist.date_played as starttime FROM historylist,songlist WHERE (historylist.songID = songlist.ID) AND (songlist.songtype='S' OR songlist.songtype='I' OR songlist.songtype='A' OR songlist.songtype='V' OR songlist.songtype='C') ORDER BY historylist.date_played DESC",1);
// Going by each row into a local expression...
$history = $db->rows();
// Reset...
reset($history);
// Grabbing the contents for the query list.
$db->open("SELECT songlist.*, queuelist.requestID as requestID FROM queuelist, songlist WHERE (queuelist.songID = songlist.ID) AND (songlist.songtype='S' OR songlist.songtype='I' OR songlist.songtype='A' OR songlist.songtype='V' OR songlist.songtype='C') AND (songlist.artist <> '') ORDER BY queuelist.sortID ASC",1);
// Same deal...
$queue = $db->rows();
// Reset...
reset($queue);
//### Calculate the bezt time to refresh the webpage in order to show new updated song information - not used
//==================================================================================================
list($key, $song) = each($history);
$listeners = $song['listeners'];
$curtime = time()-9200;
$starttime = strtotime($song['date_played']);
$secsRemain = (round($song['duration'] / 1000)-($curtime-$starttime));
//Set refesh interval
if ($timeleft > 0)
$timeout = $timeleft;
else
$timeout = 90;
if (($timeout > 180) || ($timeout == 0))
$timeout = 180;
if ($timeout < 10)
$timeout = 12;
//==================================================================================================
}
*/
//Detects what show is playing
if ($data_array2 == 'The Main Event - Live Show') {
$show = "images/playlive_mainevent.png";
$showinfo = "false";
}
if ($data_array2 == 'The Windmill Hut - Live Show') {
$show = "images/playlive_windmillhut.png";
$showinfo = "false";
}
if ($data_array2 == 'DJ Sam - Kingdom Hearts') {
$show = "images/playlive_kingdomhearts.png";
$showinfo = "false";
}
if ($data_array2 == 'Mario Mixup Hour') {
$show = "images/playlive_mario.png.png";
$showinfo = "false";
}
if ($data_array2 == 'The Nitelife') {
$show = "images/playlive_nitelife.png";
$showinfo = "true";
}
if ($data_array2 == 'The Best of ZREO') {
$show = "images/playlive_zreo.png";
$showinfo = "true";
}
if ($data_array2 == 'The Blank Report') {
$show = "images/playlive_zreo.png";
$showinfo = "false";
}
if ($data_array2 == 'Ten Swords, Blue Vampires, etc') {
$show = "images/playlive_tenswords.png";
$showinfo = "false";
}
else {
$show = "images/playlive_djsam.png";
$showinfo = "true";
}
?>
<script src="scriptaculous.js" type="text/javascript"></script>
<script src="prototype.js" type="text/javascript"></script>
<? if ( $data_array["0"] == "Server is currently up and public." ) { $status = "online"; } else { $status = "offline"; } ?>
<div id="content" style="width: 600px;">
<? if ($status == "online") { ?>