注册 登录
编程论坛 JavaScript论坛

大哥大姐谁给看看让我这投票系统一小时投一票

五常小伙 发布于 2013-11-22 09:22, 438 次点击
<!--#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>
1 回复
#2
java小蚂蚁2013-11-22 11:44
你可以写个定时器,一小时一调用,或者有单线程,sleep一小时在运行
1