Advertisement
Guest User

Untitled

a guest
Jun 25th, 2017
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.83 KB | None | 0 0
  1. <?
  2. require("config.php");
  3.  
  4. $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",6);
  5. $history = $db->rows();
  6. reset($history);
  7.  
  8. $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",2);
  9. $queue = $db->rows();
  10. reset($queue);
  11.  
  12.  
  13. //### Calculate the bezt time to refresh the webpage in order to show new updated song information
  14. //==================================================================================================
  15. list($key, $song) = each($history);
  16. $listeners = $song["listeners"];
  17.  
  18. $starttime = strtotime($song["date_played"]);
  19. $curtime = time();
  20. $timeleft = $starttime+round($song["duration"]/1000)-$curtime;
  21.  
  22. //Set refesh interval
  23. if($timeleft>0) # 30 second minimum wait
  24. { $timeout = $timeleft;} # if timeleft is valid, refresh on timeleft (should be end of song)
  25. else
  26. { $timeout = 90; } # otherwise, fall back on 90 second refresh
  27.  
  28. if(($timeout>180) or ($timeout==0)) $timeout = 180;
  29. if($timeout<30) $timeout = 30;
  30.  
  31. $refreshURL = "playing.php?buster=".date('dhis').rand(1,1000);
  32. //==================================================================================================
  33.  
  34.  
  35. $pic_cnt = 0;
  36. function PicName()
  37. {
  38. global $pic_cnt;
  39. echo "Picture".$pic_cnt;
  40. }
  41.  
  42. function NextPicName()
  43. {
  44. global $pic_cnt;
  45. $pic_cnt += 1;
  46. PicName();
  47. }
  48.  
  49. function PutSongRow(&$song)
  50. {
  51. global $rc, $showpic, $darkrow, $lightrow;
  52. PrepareSong($song);
  53.  
  54. $rc++;
  55. $bgcolor = $darkrow;
  56. if(($rc % 2)==0) $bgcolor = $lightrow;
  57.  
  58. ?>
  59. <tr bgcolor="<? echo $bgcolor; ?>">
  60.  
  61. <?if($showpic){?>
  62. <td valign="middle" width="1%">
  63. <? if($song["haspicture"]) {?>
  64. <a href="<? echo $song["buycd"]; ?>" target="_blank"><img id="<? NextPicName(); ?>" onError="PictureFail('<? PicName(); ?>')" width="60" height="60" src="<? echo $song["picture"]; ?>" alt="Buy CD!" border=0></a>
  65. <?};?>
  66. </td>
  67. <?}?>
  68.  
  69.  
  70. <td <?if(!$showpic) echo "colspan=2"?>><font size="2" color="#003366"><small><?
  71. echo $song["combine"];
  72. if($song["requestid"]!=0) { echo " ~requested~ "; }
  73. ?></small></font></td>
  74. <td nowrap width="1%">
  75. <p align="center"><font size="2" color="#003366"><a href="<? echo $song["buycd"]; ?>" target="_blank"><img
  76. src="images/buy.gif" alt="Buy this CD now!" border="0"></a></font>
  77. </td>
  78. <td nowrap width="1%">
  79. <p align="center"><font size="2" color="#003366"><a href="<? echo $song["website"]; ?>" target="_blank"><img
  80. src="images/home.gif" alt="Artist homepage" border="0"></a></font>
  81. </td>
  82.  
  83. <td nowrap align="center" nowrap width="1%">
  84. <font size="2" color="#003366"><a href="javascript:songinfo(<? echo $song["songid"]; ?>)"><img
  85. src="images/info.gif" alt="Song information" border="0"></a></font>
  86. </td>
  87.  
  88. <td nowrap><font color="#003366" size="2"><small><? echo $song["album"]; ?></small></font></td>
  89. <td nowrap>
  90. <p align="right"><font color="#003366" size="2"><small><strong><? echo $song["mmss"]; ?></strong></small></font>
  91. </td>
  92. </tr>
  93. <?
  94. }//PutSongRow
  95.  
  96. /* ## ===================================================================== ## */
  97. ?>
  98.  
  99. <? require("header.php"); ?>
  100.  
  101. <SCRIPT LANGUAGE="JavaScript">
  102. <!---
  103. var refreshID = "";
  104. refreshID = setTimeout("DoRefresh()", <? echo ($timeout*1000); ?>);
  105.  
  106. function DoRefresh()
  107. {
  108. document.location.href = '<? echo $refreshURL; ?>';
  109. }
  110. //--->
  111. </SCRIPT>
  112.  
  113. <?if($listeners>0)
  114. echo "There are currently $listeners listeners tuned into this station!<br><br>";
  115. ?>
  116. <table border="0" width="98%" cellspacing="0" cellpadding="4">
  117. <tr bgcolor="34fff">
  118. <td colspan="2" nowrap align="left">
  119. <p><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="blue"><b>Currently Playing</b></font>
  120. </td>
  121. <td colspan="3" nowrap align="center">
  122. <p><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="blue"><b>Links</b></font>
  123. </td>
  124. <td nowrap align="left">
  125. <p><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="blue"><b>Album</b></font>
  126. </td>
  127. <td nowrap align="Right">
  128. <p><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="blue"><b>Time</b></font>
  129. </td>
  130. </tr>
  131.  
  132. <?
  133. $rc=0;
  134. PutSongRow($song);
  135. $mainsong = $song;
  136. ?>
  137.  
  138.  
  139. <?
  140. if(count($queue)>0){?>
  141. <tr bgcolor="<? echo $lightrow; ?>"><td colspan="7">
  142. <b><font size="2" color="blue">Coming up:</font></b>
  143.  
  144. <font size="2" color="003366"><b>
  145. <?
  146. $i=0;
  147. while(list($key, $song) = each($queue))
  148. {
  149. if(empty($song["artist"]))
  150. $song["artist"] = 'Unknown';
  151.  
  152. if($i>0) echo ", ";
  153. echo $song["artist"];
  154. if($song["requestid"]!=0)
  155. { echo " ~requested~"; }
  156. $i++;
  157.  
  158. }
  159. ?>
  160. </b></font></td></tr>
  161. <?}?>
  162.  
  163. <tr bgcolor="34fff">
  164. <td colspan="7" nowrap>
  165. <p align="left"><b><font size="1" face="Verdana, Arial, Helvetica, sans-serif" color="blue">Recently
  166. played songs</font></b>
  167. </td>
  168. </tr>
  169.  
  170. <?
  171. $rc=0;
  172. while(list($key, $song) = each($history))
  173. PutSongRow($song);
  174. ?>
  175. </table>
  176.  
  177. </td><td valign='top' align='center'>
  178.  
  179. <?
  180. ####################
  181. # Request Dedication
  182. require("dedication.php");
  183. #===================
  184. ?>
  185.  
  186. <?
  187. ####################
  188. # BuyCD image
  189. if($mainsong["haspicture"])
  190. require("buycd.php");
  191. #===================
  192. ?>
  193.  
  194.  
  195. <?
  196. ##################
  197. # Top 10 requests
  198. if($showtoprequests)
  199. require("top10requests.php");
  200. #===================
  201. ?>
  202.  
  203.  
  204. </td>
  205.  
  206. <? require("footer.php"); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement