asp投票系统怎样设置一天一个IP只能投票5次

来源:百度知道 编辑:UC知道 时间:2024/04/29 13:42:01
我的想法是这样的:
读取数据库投票表,如果同一个IP有五次,并且判断在一天内,就弹出警告框提示出错.
但ASP代码我不熟悉,有高手指教一下吗?

我给你段代码。表youip 字段ID,IP,,times,NUM
<%
dim ip
ip=request.servervariables("remote_addr")
times=date()
set rs=server.createobject("adodb.recordset")
sql="select * from youip where ip='"&ip&"'"
rs.open sql,conn,1,3
if not(rs.bof and rs.eof)then
if rs("num")>=5 and rs("times")=date() then
response.write "<script language="javascript">" &_ chr(13)
response.write "alert('投票今天超过5次,请明天来')"
response.write "window.document.location.href=;'../"_"&chr(13)
response.write"</script>" & chr(13)
response.end
rs.close
set rs=noting
conn.close
else
num=rs("num")
rs("num")=num+1
rs.update
end if
else
rs.addnew
ip("ip")=ip
rs("times")=times
rs.update
end if
%>
<%<