query("insert into {$dbtbpre}enewsvote(title,votetext,votenum,voteip,voteclass,doip,votetime,dotime,width,height,addtime,tempid) values('$title','$votetext',$t_votenum,'',$voteclass,$doip,$votetime,'$dotime',$width,$height,'$addtime',$tempid);"); //生成投票js $voteid=$empire->lastid(); GetVoteJs($voteid); if($sql) { //操作日志 insert_dolog("voteid=".$voteid."title=".$title); printerror("AddVoteSuccess","AddVote.php?enews=AddVote".hReturnEcmsHashStrHref2(0)); } else {printerror("DbError","history.go(-1)");} } //修改投票 function EditVote($voteid,$title,$votename,$votenum,$delvid,$vid,$voteclass,$doip,$dotime,$width,$height,$tempid,$userid,$username){ global $empire,$dbtbpre; $voteid=(int)$voteid; if(!$voteid||!$title||!$tempid) {printerror("EmptyVoteTitle","history.go(-1)");} //验证权限 CheckLevel($userid,$username,$classid,"vote"); //返回组合 $votetext=ReturnVote($votename,$votenum,$delvid,$vid,1); //统计总票数 for($i=0;$ifetch1("select dotime,votetime from {$dbtbpre}enewsvote where voteid='$voteid'"); $votetime=to_date($dotime); //处理变量 $t_votenum=(int)$t_votenum; $voteclass=(int)$voteclass; $votetime=(int)$votetime; $width=(int)$width; $height=(int)$height; $doip=(int)$doip; $tempid=(int)$tempid; $title=hRepPostStr($title,1); $votetext=AddAddsData($votetext); $dotime=hRepPostStr($dotime,1); $sql=$empire->query("update {$dbtbpre}enewsvote set title='$title',votetext='$votetext',votenum=$t_votenum,voteclass=$voteclass,doip=$doip,dotime='$dotime',votetime=$votetime,width=$width,height=$height,tempid=$tempid where voteid='$voteid'"); //生成投票js GetVoteJs($voteid); if($sql) { //操作日志 insert_dolog("voteid=".$voteid."title=".$title); printerror("EditVoteSuccess","ListVote.php".hReturnEcmsHashStrHref2(1)); } else {printerror("DbError","history.go(-1)");} } //删除投票 function DelVote($voteid,$userid,$username){ global $empire,$dbtbpre; $voteid=(int)$voteid; if(!$voteid) {printerror("NotDelVoteid","history.go(-1)");} //验证权限 CheckLevel($userid,$username,$classid,"vote"); $r=$empire->fetch1("select title from {$dbtbpre}enewsvote where voteid='$voteid'"); $sql=$empire->query("delete from {$dbtbpre}enewsvote where voteid='$voteid'"); $file="../../../d/js/vote/vote".$voteid.".js"; DelFiletext($file); if($sql) { //操作日志 insert_dolog("voteid=".$voteid."title=".$r[title]); printerror("DelVoteSuccess","ListVote.php".hReturnEcmsHashStrHref2(1)); } else {printerror("DbError","history.go(-1)");} } //批量生成投票 function ReVoteJs_all($start=0,$from,$userid,$username){ global $empire,$public_r,$fun_r,$dbtbpre; $moreportpid=(int)$_GET['moreportpid']; $mphref=''; if($moreportpid) { $mphref=Moreport_ReturnUrlCsPid($moreportpid,0,0,''); } $start=(int)$start; $b=0; $sql=$empire->query("select voteid from {$dbtbpre}enewsvote where voteid>$start order by voteid limit ".$public_r['revotejsnum']); while($r=$empire->fetch($sql)) { $b=1; $newstart=$r[voteid]; GetVoteJs($r[voteid]); } if(empty($b)) { //操作日志 insert_dolog(""); printerror("ReVoteJsSuccess",$from); } echo $fun_r['OneReVoteJsSuccess']."(ID:".$newstart.")"; exit(); } //生成投票js function GetVoteJs($voteid){ global $empire,$public_r,$fun_r,$dbtbpre; $r=$empire->fetch1("select * from {$dbtbpre}enewsvote where voteid='$voteid'"); //模板 $votetemp=ReturnVoteTemp($r[tempid],1); $votetemp=RepVoteTempAllvar($votetemp,$r); $listexp="[!--empirenews.listtemp--]"; $listtemp_r=explode($listexp,$votetemp); $file=eReturnTrueEcmsPath()."d/js/vote/vote".$voteid.".js"; $r_exp="\r\n"; $f_exp="::::::"; //项目数 $r_r=explode($r_exp,$r[votetext]); $checked=0; for($i=0;$i";} else {$vote="";} $votetext.=RepVoteTempListvar($listtemp_r[1],$vote,$f_r[0]); } $votetext="document.write(\"".addslashes(stripSlashes($listtemp_r[0].$votetext.$listtemp_r[2]))."\");"; WriteFiletext_n($file,$votetext); } $enews=$_POST['enews']; if(empty($enews)) {$enews=$_GET['enews'];} if($enews) { hCheckEcmsRHash(); } //设置访问端 $moreportpid=0; if($enews=='ReVoteJs_all') { $moreportpid=Moreport_hDoSetSelfPath(0); } //增加投票 if($enews=="AddVote") { $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']; AddVote($title,$votename,$votenum,$delvid,$vid,$voteclass,$doip,$dotime,$width,$height,$tempid,$logininid,$loginin); } //修改投票 elseif($enews=="EditVote") { $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']; EditVote($voteid,$title,$votename,$votenum,$delvid,$vid,$voteclass,$doip,$dotime,$width,$height,$tempid,$logininid,$loginin); } //删除投票 elseif($enews=="DelVote") { $voteid=$_GET['voteid']; DelVote($voteid,$logininid,$loginin); } //批量刷新投票JS elseif($enews=="ReVoteJs_all") { ReVoteJs_all($_GET['start'],$_GET['from'],$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,title,addtime from {$dbtbpre}enewsvote"; $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="管理投票"; ?> 投票 位置: =$url?> ID 投票标题 发布时间 调用地址 操作 while($r=$empire->fetch($sql)) { ?> =$r[voteid]?> =$r[title]?> =$r[addtime]?> [预览] [修改] [删除] } ?> =$returnpage?> 说明:模板中显示投票的地方加上:<script src=调用地址></script> 或者 [phomevote]投票ID[/phomevote] db_close(); $empire=null; ?>