//
<?php
//插件设置

$haveother=1; //是否有日周月点击  1为开启日周月点击 0为关闭
//插件设置
require ("../e/class/connect.php");
require ("../e/class/db_sql.php");
$link=db_connect();
$empire=new mysqlquery;
$now=time();
$id=(int)$_GET[id];
$classid=(int)$_GET[classid];
if($haveother){
$sql="select id,onclick,dayclick,weekclick,moonclick,lastclicktime from {$dbtbpre}ecms_movie where id='$id' limit 1 ";
$r=$empire->fetch1($sql);
$lasttime=$r[lastclicktime];
$onclick=$r[onclick];
$dayclick=$r[dayclick];
$weekclick=$r[weekclick];
$moomclick=$r[moonclick];
$up='';
$query="update {$dbtbpre}ecms_movie set onclick=onclick+1,dayclick=dayclick+1,weekclick=weekclick+1,moonclick=moonclick+1,lastclicktime='$now' where id='$id'";
$nowweek=date("W",$now); $nowday=date("d",$now); $nowmoon=date("m",$now);
$lastweek=date("W",$lasttime); $lastday=date("d",$lasttime); $lastmoon=date("m",$lasttime);
if($nowday!=$lastday){
$up="update {$dbtbpre}ecms_movie set dayclick=0,lastclicktime='$now'";
}
if($nowmoon!=$lastmoon){
$up="update {$dbtbpre}ecms_movie set moonclick=0,lastclicktime='$now'";
}
if($nowweek!=$lastweek){
$up="update {$dbtbpre}ecms_movie set weekclick=0,lastclicktime='$now'";
}
if($up){
	$u=$empire->query($up);
}
$click=$empire->query($query);
echo '11';
}
else{
$sql="select id,onclick from {$dbtbpre}ecms_movie where id='$id' limit 1 ";
	
$r=$empire->fetch1($sql);
$onclick=$r[onclick];
	
$query="update {$dbtbpre}ecms_movie set onclick=onclick+1 where id='$id'";
//echo '//'.$onclick+1;
	echo '12';
}
db_close();
$empire->NULL;
?>