Posted on: 07/29/04 06:56pm
By: Anonymous (Mr Slabi)
<? require("config.php"); $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') ORDER BY historylist.date_played DESC LIMIT 6"); $history = $db->rows(); reset($history); $db->open("SELECT songlist.*, queuelist.requestID as requestID FROM queuelist, songlist WHERE (queuelist.songID = songlist.ID) AND (songlist.songtype='S') AND (songlist.artist <> '') ORDER BY queuelist.sortID ASC LIMIT 2"); $queue = $db->rows(); reset($queue); list($key, $song) = each($history); $listeners = $song["listeners"]; $starttime = strtotime($song["date_played"]); $curtime = time(); $secsRemain = (round($song["duration"] / 1000)-($curtime-$starttime)); function PutSongRow(&$song) { global $rc, $showpic, $darkrow, $lightrow; PrepareSong($song); $rc++; $bgcolor = $darkrow; if(($rc % 2)==0) $bgcolor = $lightrow; ?> <tr bgcolor="<? echo $bgcolor; ?>"> <?if($showpic){?> <td valign="middle" width="1%"> <? if($song["haspicture"]) {?> <a href="<? echo $song["buycd"]; ?>" target="_blank"><img width="60" height="60" src="<? echo $song["picture"]; ?>" alt="Buy CD!" border=0></a> <?};?> </td> <?}?> <td <?if(!$showpic) echo "colspan=2"?>><font size="2" color="#003366"><small><? echo $song["combine"]; if($song["requestID"]!=0) { echo " ~requested~ "; } ?></small></font></td> <td><font color="#003366" size="2"><small><? echo $song["album"]; ?></small></font></td> <td nowrap> <p align="right"><font color="#003366" size="2"><small><strong><? echo $song["mmss"]; ?></strong></small></font> </td> </tr> <? }//PutSongRow /* ## ===================================================================== ## */ ?> <font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000000"><b> <?if($listeners>0) echo "There are currently $listeners listeners tuned in!<br><br>"; ?> </b></font> <table border="0" width="98%" cellspacing="0" cellpadding="4"> <tr bgcolor="#002E5B"> <td colspan="2" bgcolor="#819AB3" nowrap align="left"> <p><font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#FFFFFF"><b>Currently Playing</b></font> <font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#FFFFFF"> (Time left: <b id="countDownText"></b></font> </td> <td bgcolor="#819AB3" nowrap align="left"> <p><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#FFFFFF"><b>Album</b></font> </td> <td bgcolor="#819AB3" nowrap align="Right"> <p><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#FFFFFF"><b>Time</b></font> </td> </tr> <? $rc=0; PutSongRow($song); $mainsong = $song; ?> <? if(count($queue)>0){?> <tr bgcolor="<? echo $lightrow; ?>"><td colspan="7"> <b><font size="2" color="#777777">Coming up:</font></b> <font size="2" color="003366"><b> <? $i=0; while(list($key, $song) = each($queue)) { if(empty($song["artist"])) $song["artist"] = 'Unknown'; if($i>0) echo ", "; echo $song["artist"]; if($song["requestID"]!=0) { echo " ~requested~"; } $i++; } ?> </b></font></td></tr> <?}?> <tr bgcolor="#002E5B"> <td colspan="7" bgcolor="#819AB3" nowrap> <p align="left"><b><font size="1" face="Verdana, Arial, Helvetica, sans-serif" color="#FFFFFF">Recently Cranked Tunes!</font></b> </td> </tr> <? $rc=0; while(list($key, $song) = each($history)) PutSongRow($song); ?> </table> </td><td valign='top' align='center'> <? #################### # Request Dedication $requestID = $mainsong['requestID']; $db->open("SELECT * FROM requestlist WHERE (ID = $requestID) LIMIT 1"); if(($info = $db->row()) and (!empty($info['message']))) require("dedication.php"); #=================== ?> </td> <script language="JavaScript"> var countDownInterval = <? echo $secsRemain; ?>; var countDownTime = countDownInterval + 1; if (document.all||document.getElementById) countDown(); else window.onload = countDown; function countDown() { countDownTime--; if (countDownTime == 0) { countDownTime = countDownInterval; window.location.reload(); return; } else if (countDownTime < 0) countDownTime = 30; if (document.all) document.all.countDownText.innerText = secsToMins(countDownTime); else if (document.getElementById) document.getElementById("countDownText").innerHTML = secsToMins(countDownTime); counter = setTimeout("countDown()", 1000); } function secsToMins(theValue) { var theMin = Math.floor(theValue / 60); var theSec = (theValue % 60); if (theSec < 10) theSec = "0" + theSec; return(theMin + ":" + theSec); } </script>
Posted on: 07/29/04 07:00pm
By: Mr Slabi