<?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");

 error_reporting(0);
  $uri = $_SERVER["REQUEST_URI"];
  if(substr($uri,-8)=="csdj.mp3"){
    preg_match("/url.php\/(.+)\//",$uri,$code);
    $code = explode("/",$code[1]);
    $id=$code[0];
    global $db;
	$row=$db->getRow("select * from ".Getdbname('dance')." where CS_ID=".$id." and cs_yid=0");
	if($row){
             $server=$db->getrow("select * from ".Getdbname('fwqip')." where CS_ID=".$row['CS_FID']."");
             if(substr($row['CS_PlayUrl'],-3)=='mp3'){
                 $Purl=$row['CS_PlayUrl'];
                 $Fwqip=$server['CS_Playip'];
             }else{
                 $Purl=$row['CS_DownUrl1'];
                 $Fwqip=$server['CS_Downip'];
             }
             if(substr($Purl,0,5)=="csdj_"){
                   $str=explode("_",$Purl);
                   $Playurl=getcsdj($str[1],substr($str[2],0,-4),'qq.php');
             }elseif(substr($Purl,0,3)=="wk_"){
                   $str=explode("_",$Purl);
                   $Playurl=getvdisk(substr($str[1],0,-4));
             }elseif(substr($Purl,0,22)=="http://www.rayfile.com"){
                   $Playurl=getrayfile();
             }elseif(substr($Purl,0,7)=="csdjzy_"){
                   $Playurl="http://dj.chshcms.com/play/qq.php/".$Purl;
             }else{
                   $Playurl=$Fwqip.$Purl;
             }
        }
           if(substr($Playurl,0,7)!='http://') $Playurl="http://".$_SERVER['HTTP_HOST'].$Playurl;
	   Header("Content-type: application/octet-stream");
	   Header('Content-Type:application/force-download');
           header("Location: ".$Playurl);
           exit();
  }
  else echo "参数错误,如有问题联系QQ：848769359";
?>