<?php
include "../../include/conn.php";
include "../../include/function.php";
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();}
$ac=SafeRequest("action","get");
if($ac=="goodbad"){
	global $db;
	$S_ID=SafeRequest("id","get");
	$sql="Select * from s_video where S_ID=".$S_ID."";
	if($row=$db->Getrow($sql)){
		$S_ID=$row['S_ID'];
		$OuHits=$row['S_Apex'];
		$OdHits=$row['S_Tread'];
		$nCount=$row['S_Apex']+$row['S_Tread'];
		if($OuHits==$OdHits){
			$uHits="50";
			$dHits="50";
		}else{
			$uHits=$OuHits/$nCount*100;
			$dHits=$OdHits/$nCount*100;
		}
	}
	$showstr="";
	$showstr=$showstr."<div class=\"play-dig-good\"><h5 onClick=\"up_down($S_ID, 'good')\">好听<span id=\"good_times\">($OuHits)</span></h5><h6><span style=\"width:$uHits%\"></span></h6></div>";
	$showstr=$showstr."<div class=\"play-dig-bad\"><h5 onClick=\"up_down($S_ID, 'bad')\">难听<span id=\"bad_times\">($OdHits)</span></h5><h6><span style=\"width:$dHits%\"></span></h6></div>";
	echo escape($showstr);
	//echo $showstr;
}elseif($ac=="doHits"){
	global $db;
	$S_ID=SafeRequest("id","get");
	$dowhat=SafeRequest("dowhat","get");
	if($dowhat=="good"){	
		$sql="update s_video set S_Apex=S_Apex+1 where S_ID=".$S_ID."";
	}else{
		$sql="update s_video set S_Tread=S_Tread+1 where S_ID=".$S_ID."";
        }
        $cookies="doHits_dj_$S_ID";
	if($_COOKIE[$cookies]=="yes"){
		echo escape("Err_145");
	}else{
		setcookie($cookies,"yes",time()+86400);
		if($db->query($sql)){}
        }
}elseif($ac=="doUserFav"){
	global $db;
	$S_ID=SafeRequest("id","get");
	$sql="select * from s_usersc where S_Djid='".$S_ID."' order by s_addtime desc";
	$rs=$db->query($sql);
	$num=$db->num_rows($rs);
	if($num==0) echo "";
	$nums=12;
	if($num<$nums){
		$j=$num;
	}else{
		$j=$nums;
	}
	$showstr="";
	for($i=0;$i<$j;$i++){
		$row=$db->fetch_array($rs);
		$upic=$db->getrow("select * from s_users where S_Name='".$row["S_User"]."'");
	$showstr=$showstr."<li><a title=进入".$row["S_User"]."的个人主页看看 href=".userlink("index",$row["S_User"])." target=web><img src=".piclink("logo",$upic["S_Logo"],"big")." onerror=\"javascript:this.src='/images/nopic.gif'\"><p>".$row["S_User"]."</p></a></li>";
	}
	echo escape($showstr);
	//echo $showstr;
}elseif($ac=="doUserDown"){
	global $db;
	$S_ID=SafeRequest("id","get");
	$sql="select * from s_down where S_Djid='".$S_ID."' order by s_addtime desc";
	$rs=$db->query($sql);
	$num=$db->num_rows($rs);
	if($num==0) echo "";
	$nums=18;
	if($num<$nums){
		$j=$num;
	}else{
		$j=$nums;
	}
	$showstr="";
	for($i=0;$i<$j;$i++){
		$row=$db->fetch_array($rs);
		$upic=$db->getrow("select * from s_users where S_Name='".$row["S_User"]."'");
           if(substr($upic["S_Logo"],0,7)=="/0792dj"){
                 $S_Logo="http://www.dj207.com/upload/userlogo/big".$upic["S_Logo"];
           }else{
                 $S_Logo="/upload/userlogo/big".$upic["S_Logo"];
           }
	$showstr=$showstr."<li><a title=进入".$row["S_User"]."的个人主页看看 href=".userlink("index",$row["S_User"])." target=web><img src=".piclink("logo",$upic["S_Logo"],"big")." onerror=\"javascript:this.src='/images/nopic.gif'\"><p>".$row["S_User"]."</p></a></li>";
	}
	echo escape($showstr);
	//echo $showstr;
}
?>