<?php
include("../../class/connect.php");
$id=(int)$_GET['id'];
$classid=(int)$_GET['classid'];
if($id&&$classid)
{
	include("../../class/config.php");
	include("../../class/db_sql.php");
	include("../../class/class.php");
	$link=db_connect();
	$empire=new mysqlquery();
	$doajax=(int)$_GET['doajax'];
	$editor=1;
	if(empty($class_r[$classid][tbname]))
	{
		$doajax==1?ajax_printerror():printerror('ErrorUrl','',1);
    }
	$checkid=$classid.'n'.$id;
	$checktime=time()+24*3600;
	//连续提交
	if(getcvar('lastdiggid')==$checkid)
	{
		$doajax==1?ajax_printerror():printerror('ReDigg','',1);
	}
	$dotop=(int)$_GET['dotop'];
	if($dotop)
	{
		$n='+1';
		$mess='DoDiggGSuccess';
	}
	else
	{
		$n='-1';
		$mess='DoDiggBSuccess';
	}
	$sql=$empire->query("update {$dbtbpre}ecms_".$class_r[$classid][tbname]." set diggtop=diggtop".$n." where id='$id'");
	if($sql)
	{
		esetcookie('lastdiggid',$checkid,$checktime);	//最后发布
		if($doajax==1)
		{
			$nr=$empire->fetch1("select diggtop from {$dbtbpre}ecms_".$class_r[$classid][tbname]." where id='$id'");
			$num=$_GET['ajaxarea'].'|'.$nr['diggtop'];
			ajax_printerror($num);
		}
		else
		{
			printerror($mess,'',1);
		}
    }
	else
	{
		$doajax==1?ajax_printerror():printerror('DbError','',1);
	}
}
?>