<?php
ob_start();
session_start();
require_once("config.php");
?>
<!---表单部分
点击投票
<form name="frm" action="{dede:global.cfg_cmsurl/}/toupiao/index.php" method="post">
<input type="hidden" name="itm" value="{dede:field.aid/}" >
<input type="submit" value="投票" />
</form>
-->
<a href="javascript:history.go(-1);">向上一页</a>
<?php
//print_r($_POST);
if(@$_POST["itm"]){
if(@$_SESSION["vote"]==session_id())
{
?>
<script language="javascript">
alert("您已经投票了");
location.href="javascript:history.go(-1);";
</script>
<?php
exit();
}
$id=$_POST["itm"];
$sql="update dede_addon17 set num=num+1 where aid=$id";
if(mysql_query($sql))
{
$_SESSION["vote"]=session_id();
?>
<script language="javascript">alert("投票成功");location.href="javascript:history.go(-1);";</script>
<?php
}
else
{
?>
<script language="javascript">alert("投票失败");location.href="javascript:history.go(-1);";</script>
<?php
}
}
?>