<?php
# Name: PHP版程氏音乐CMS管理系统 v3.0
# Author: 程氏<web@chshcms.com> [QQ:848769359]
# Homepage:http://www.chshcms.cn/
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); 
header("Cache-Control: no-cache, must-revalidate"); 
header("Pragma: no-cache");
if(!eregi($_SERVER['SERVER_NAME'],$_SERVER['HTTP_REFERER'])){exit('QQ:848769359');}
include_once("../../lib/cs_conn.php");
include_once("../../lib/cs_common.php");
$id=CS_Request('id');
?>
var num = 0;
var obj,oRd;
var playerArray;

function DoPlay(url){
     if(navigator.appName.indexOf("Microsoft")!=-1){
	obj=window.myFlashContent;
     }else{
	obj=document.getElementById("myFlashContent");
     }
   obj.PlayS(url);
}

function PlayO(){  //播放结束
        var New=document.getElementsByName("listloop");
        var strNew;
             for(var i=0;i<New.length;i++)   {
                  if(New.item(i).checked){
                        strNew=New.item(i).getAttribute("value");
                        break;
                  }else{
                        continue;  
                  }   
             }   
        if(strNew=="listloop"){ //顺序播放
	    play_next();
        }else{  //循环单曲
	    cutplayer(num);
        }
}

function oReady(){
	oRd=true;
}

function PlayFirst(){
	DoPlay(playerURL());
}

function playerURL() {
	playerArray = new Array(
<?php
     $shows="";
     $ids=explode(",",$id);
	for($j=0;$j<count($ids);$j++){
            $row=$db->getrow("select * from ".Getdbname('dance')." where CS_ID=".$ids[$j]."");
            $Playurl='http://'.$_SERVER['HTTP_HOST'].CS_WebPath.'public/url.php/'.$ids[$j].'/csdj.mp3';
	    $shows=$shows.'["'.$Playurl.'", "'.$row['CS_Name'].'", "'.$row['CS_ID'].'", "'.$row['CS_Hits'].'", "'.$row['CS_Shits'].'", "'.$row['CS_Xhits'].'"],';
        }
        $shows.="]]]";
        $shows=CS_ReplaceStr($shows,',]]]','');	
        echo $shows;
?>
        );
	iShowtext(num);
	return playerArray[num][0]
};

function iShowtext(j) {
	if (j <= 0) {
	    sid=playerArray.length - 1;
	}else{
	    sid = j - 1;
        };
	if (j >= (playerArray.length - 1)) {
	    xid=0;
        }else{
	    xid = j + 1;
	};
        getdoHits(playerArray[j][2]);
	document.getElementById("PlayerTitle").innerHTML = "正在播放："+playerArray[j][1];
	document.getElementById("usericon").innerHTML = "<a href=\"javascript:Popsboxif('歌曲报错',450,305,'/public/error.php?id="+playerArray[j][2]+"');\">不能听?报错</a>　<a onclick=\"Copyurl();return false;\" href=\"#\">推荐给朋友</a>　<a href=\"javascript:;\">已试听["+playerArray[j][3]+"]次</a>　<a href=\"/user/do.php?ac=fav&id="+playerArray[j][2]+"\" target=\"u\">已收藏["+playerArray[j][4]+"]次</a>　<a href=\"javascript:Popsboxif('下载歌曲',450,180,'/public/down.php?id="+playerArray[j][2]+"');\">已下载["+playerArray[j][5]+"]次</a>　";
	document.getElementById("sname").innerHTML ="<a href=\"javascript:play_last();\">上一首："+playerArray[sid][1]+"</a>";
	document.getElementById("xname").innerHTML ="<a href=\"javascript:play_next();\">下一首："+playerArray[xid][1]+"</a>";
	document.title = innerHTML = playerArray[j][1] + " - 程氏舞曲CMS www.chshcms.com";
	document.getElementById('list' + j).style.background = "#ccc"
};
function play_last() {
	if (num <= 0) {
	    document.getElementById('list' + num).style.background = "";
	    num=playerArray.length - 1;
	}else{
	    document.getElementById('list' + num).style.background = "";
	    num = num - 1;
        };
	cutplayer(num)
};
function play_next() {
	if (num >= (playerArray.length - 1)) {
	    document.getElementById('list' + num).style.background = "";
	    num=0;
        }else{
	    document.getElementById('list' + num).style.background = "";
	    num = num + 1;
	};
	cutplayer(num)
};
function cutplayer(temp) {  //播放
	document.getElementById('list' + num).style.background = "";
	num = temp;
	DoPlay(playerURL());
};
<?php
     $showstr="";
     $ids=explode(",",$id);
	for($j=0;$j<count($ids);$j++){
            $row=$db->getrow("select * from ".Getdbname('dance')." where CS_ID=".$ids[$j]."");
	    $showstr=$showstr.'<li id="list'.$j.'"><span>&#160;'.($j+1).'.</span><a href="javascript:cutplayer('.$j.');">'.$row['CS_Name'].'</a></li>';
        }
?>
var playbomlist = '<?php echo $showstr?>';