Re: SAM Broadcaster
пишет tarasian666:
без понятия что это за скрипт от Deman'a
вы б его показали чтоль
showsong.php
<?require("config.php");?>
<html>
<META http-equiv=Content-Type content="text/html; charset=windows-1251">
<title><? echo "$station";?></title>
<body bgcolor=#000000>
<?
$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);
$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",2);
$queue = $db->rows();
reset($queue);
//### Вычесление наилучшего времени обновления веб страници. Необходимо для для обновления информации о трэке
//==================================================================================================
list($key, $song) = each($history);
$listeners = $song["listeners"];
$starttime = strtotime($song["date_played"]);
$curtime = time();
$timeleft = $starttime+round($song["duration"]/1000)-$curtime;
//Установка интервала обновления
if($timeleft>0) # ждать минимум 30 секунд
{ $timeout = $timeleft;} # если timeleft равно timeleft то страница обнавляется (это примерно конец трека)
else
{ $timeout = 90; } # есле нет , ждать 90 секунд
if(($timeout>150) or ($timeout==0)) $timeout = 150;
if($timeout<30) $timeout = 30;
$refreshURL = "showsong.php?buster=".date('dhis').rand(1,1000);
PrepareSong($song);
$mainsong = $song;
?>
<SCRIPT LANGUAGE="JavaScript">
<!---
var refreshID = "";
refreshID = setTimeout("DoRefresh()", <? echo ($timeout*1000); ?>);
function DoRefresh()
{
document.location.href = '<? echo $refreshURL; ?>';
}
//--->
</SCRIPT>
<font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#c8a2c8"><b>Сейчас играет</b> (осталось <b id="countDownText"></b>)<br><font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#ffffff">
<?echo $song["combine"];?></font></b><br>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#c8a2c8"><b><font face="Verdana, Arial, Helvetica, sans-serif">Следующие:</font></b><br>
<font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#ffffff">
<?
if(count($queue)>0){
$i=0;
while(list($key, $song) = each($queue))
{
if(empty($song["artist"]))
$song["artist"] = 'Неизвестен';
if($i>0) echo ", ";
echo $song["artist"];
if($song["requestid"]!=0)echo " ~заказано~";
$i++;
}
}
$requestid = $mainsong['requestid'];
if($requestid>0)
{
$db->open("SELECT name, msg FROM requestlist WHERE (ID = $requestid)",1);
if(($info = $db->row()) and (!empty($info['msg'])))
{
$info['msg'] = stripslashes($info['msg']);
?><br><b>Заказал(а):</b> <?echo $info['name'];?><br>
<b>Пожелания:</b> <?echo $info['msg'];
}
}
?>
</font><br>
<script language="JavaScript">
var countDownInterval = <? echo $timeleft ?>;
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>
</body>
</html>