高手给看看怎么实现一小时一个ip只能投一票
<!--#include file="Include/conn.asp"--><!--#include file="Include/Fun_SqlIn.Asp"-->
<!--#include file="Include/Ibcc.Asp"-->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GB2312" />
<meta http-equiv="Content-Language" content="zh-CN" />
<title>投票中心-<%=SiteTitle%></title>
<meta name="keywords" content="<%=Sitekeywords%>" />
<meta name="description" content="<%=Sitedescription%>" />
<link href="images/vote.css" rel="stylesheet" type="text/css" />
</head>
<body>
<% Dim VoTeid,HostUrl,Zuid,refuseTime
refuseTime=2 '控制最小投票间隔,单位小时
VoTeid = trim(Request("VoTeid"))
HostUrl=Request.ServerVariables("HTTP_REFERER")
Zuid=Cint(session("zhi_rui_v_userID"))
if VoTeid="" then
Call Alert ("不允许值为空,请选择后提交!","index.asp")
End if
Rem 获取IP
function getIP()
getIP = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
If getIP = "" Then
getIP = Request.ServerVariables("REMOTE_ADDR")
end if
end function
Rem 投票开关
If power=0 then
Call Alert ("投票评选活动已关闭!","index.asp")
End if
Rem 自动清除日志
sub Delip(Dve) '删除指定时间之前的投票信息
sql="delete from zhi_rui_v_Record where datediff('d',AddTime,date())>"&Dve&""
conn.execute(sql)
end sub
call Delip(Dve) '删除指定时间的投票日志
function ZhiIP(vid,ip)
sql="Select * from zhi_rui_v_Vo where Voteid="&vid&" and Hostip='"&ip&"'"
Set rs=conn.execute(sql)
if not rs.eof then
ZhiIP=true
else
ZhiIP=false
end if
end function
if ZhiIP(Voteid,getIP())=true then
Call Alert ("你的IP:"&getIP()&"已经给这位选手投票,不能继续投票!","index.asp")
end if
sql="update zhi_rui_v_po set Amio=Amio+1 where id="&Voteid
conn.execute(sql)
sql="insert into zhi_rui_v_Vo(Voteid,Userid,Hostip,HostAd,HostUl,AddTime) values("&Voteid&","&Zuid&",'"&getIP()&"','来源','"&HostUrl&"',#"&now()&"#)"
conn.execute(sql)
Call Alert("投票成功,感谢您宝贵的一票!","index.asp")
%>
</td>
</tr>
</table>
</body>
</html>