query("insert into {$dbtbpre}enewsvotemod(title,votetext,voteclass,doip,dotime,tempid,width,height,votenum,ysvotename) values('$title','$votetext',$voteclass,$doip,'$dotime',$tempid,$width,$height,$t_votenum,'$ysvotename');");
$voteid=$empire->lastid();
if($sql)
{
//操作日志
insert_dolog("voteid=".$voteid."
title=".$title);
printerror("AddVoteSuccess","AddVoteMod.php?enews=AddVoteMod".hReturnEcmsHashStrHref2(0));
}
else
{
printerror("DbError","history.go(-1)");
}
}
//修改预设投票
function EditVoteMod($voteid,$ysvotename,$title,$votename,$votenum,$delvid,$vid,$voteclass,$doip,$dotime,$width,$height,$tempid,$userid,$username){
global $empire,$dbtbpre;
$voteid=(int)$voteid;
if(!$voteid||!$ysvotename||!$tempid)
{
printerror("EmptyVoteTitle","history.go(-1)");
}
//返回组合
$votetext=ReturnVote($votename,$votenum,$delvid,$vid,1);
//统计总票数
for($i=0;$iquery("update {$dbtbpre}enewsvotemod set title='$title',votetext='$votetext',voteclass=$voteclass,doip=$doip,dotime='$dotime',tempid=$tempid,width=$width,height=$height,votenum=$t_votenum,ysvotename='$ysvotename' where voteid='$voteid'");
if($sql)
{
//操作日志
insert_dolog("voteid=".$voteid."
title=".$title);
printerror("EditVoteSuccess","ListVoteMod.php".hReturnEcmsHashStrHref2(1));
}
else
{
printerror("DbError","history.go(-1)");
}
}
//删除预设投票
function DelVoteMod($voteid,$userid,$username){
global $empire,$dbtbpre;
$voteid=(int)$voteid;
if(!$voteid)
{
printerror("NotDelVoteid","history.go(-1)");
}
$r=$empire->fetch1("select title from {$dbtbpre}enewsvotemod where voteid='$voteid'");
$sql=$empire->query("delete from {$dbtbpre}enewsvotemod where voteid='$voteid'");
if($sql)
{
//操作日志
insert_dolog("voteid=".$voteid."
title=".$r[title]);
printerror("DelVoteSuccess","ListVoteMod.php".hReturnEcmsHashStrHref2(1));
}
else
{
printerror("DbError","history.go(-1)");
}
}
$enews=$_POST['enews'];
if(empty($enews))
{$enews=$_GET['enews'];}
if($enews)
{
hCheckEcmsRHash();
}
//增加投票
if($enews=="AddVoteMod")
{
$title=$_POST['title'];
$votename=$_POST['votename'];
$votenum=$_POST['votenum'];
$delvid=$_POST['delvid'];
$vid=$_POST['vid'];
$voteclass=$_POST['voteclass'];
$doip=$_POST['doip'];
$dotime=$_POST['dotime'];
$width=$_POST['width'];
$height=$_POST['height'];
$tempid=$_POST['tempid'];
$ysvotename=$_POST['ysvotename'];
AddVoteMod($ysvotename,$title,$votename,$votenum,$delvid,$vid,$voteclass,$doip,$dotime,$width,$height,$tempid,$logininid,$loginin);
}
//修改投票
elseif($enews=="EditVoteMod")
{
$voteid=$_POST['voteid'];
$title=$_POST['title'];
$votename=$_POST['votename'];
$votenum=$_POST['votenum'];
$delvid=$_POST['delvid'];
$vid=$_POST['vid'];
$voteclass=$_POST['voteclass'];
$doip=$_POST['doip'];
$dotime=$_POST['dotime'];
$width=$_POST['width'];
$height=$_POST['height'];
$tempid=$_POST['tempid'];
$ysvotename=$_POST['ysvotename'];
EditVoteMod($voteid,$ysvotename,$title,$votename,$votenum,$delvid,$vid,$voteclass,$doip,$dotime,$width,$height,$tempid,$logininid,$loginin);
}
//删除投票
elseif($enews=="DelVoteMod")
{
$voteid=$_GET['voteid'];
DelVoteMod($voteid,$logininid,$loginin);
}
$search=$ecms_hashur['ehref'];
$page=(int)$_GET['page'];
$page=RepPIntvar($page);
$start=0;
$line=20;//每页显示条数
$page_line=12;//每页显示链接数
$offset=$page*$line;//总偏移量
$query="select voteid,ysvotename,title,voteclass from {$dbtbpre}enewsvotemod";
$num=$empire->num($query);//取得总条数
$query=$query." order by voteid desc limit $offset,$line";
$sql=$empire->query($query);
$returnpage=page2($num,$line,$page_line,$start,$page,$search);
$url="管理预设投票";
?>
投票
while($r=$empire->fetch($sql))
{
$voteclass=empty($r['voteclass'])?'单选':'多选';
?>
=$r[voteid]?>
|
=$r[ysvotename]?>
|
=$voteclass?>
|
|
}
?>
=$returnpage?>
|
db_close();
$empire=null;
?>