<?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");
$ac=CS_Request('ac');
$id=CS_Request('id');
$op=CS_Request('op');
	$showstr="";
	global $db;


if($ac=="goodbad"){
	global $db;
	$sql="Select * from ".Getdbname('dance')." where CS_ID=".$id."";
	if($row=$db->Getrow($sql)){
		$CS_ID=$row['CS_ID'];
		$DHits=$row['CS_Dhits'];
		$CHits=$row['CS_Chits'];
		$nCount=$row['CS_Dhits']+$row['CS_Chits'];
		if($DHits==$CHits){
			$DuHits="50";
			$CuHits="50";
		}else{
			$DuHits=intval($DHits/$nCount*100);
			$CuHits=intval($CHits/$nCount*100);
		}
	}

	$showstr=$showstr."<span class=\"ding\"><a href=\"###\" onclick=\"up_down($CS_ID, 'ding')\"><img src=\"".CS_WebPath."skins/index/images/ding.png\">顶一下 (<font color=red>$DHits</font>) $DuHits %</a></span>";
	$showstr=$showstr."<span class=\"cai\"><a href=\"###\" onclick=\"up_down($CS_ID, 'cai')\"><img src=\"".CS_WebPath."skins/index/images/cai.png\">踩一下 (<font color=red>$CHits</font>) $CuHits %</a></span>";

}elseif($ac=="doHits"){
	global $db;
	if($op=="ding"){	
		$sql="update ".Getdbname('dance')." set CS_Dhits=CS_Dhits+1 where CS_ID=".$id."";
	}else{
		$sql="update ".Getdbname('dance')." set CS_Chits=CS_Chits+1 where CS_ID=".$id."";
        }
        $cookies="doHits_dj_$id";
	if($_COOKIE[$cookies]=="yes"){
		echo "Err_145";
	}else{
		setcookie($cookies,"yes",time()+86400);
		$db->query($sql);
        }

}elseif($ac=="lbplay"){
     $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 onMouseOver=\"COver(this);\" onMouseOut=\"COut(this);\"><span>&nbsp;".($j+1).".</span><a href=\"javascript:;\">".$row['CS_Name']."</a></li>";
        }
}
  echo $showstr;
?>

