| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 557 人关注过本帖
标题:高手给看看怎么实现一小时一个ip只能投一票
只看楼主 加入收藏
五常小伙
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2013-11-22
结帖率:0
收藏
 问题点数:0 回复次数:1 
高手给看看怎么实现一小时一个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>
搜索更多相关主题的帖子: content include title file 中心 
2013-11-22 09:23
ysf0181
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:55
帖 子:914
专家分:2385
注 册:2006-10-4
收藏
得分:0 
你百度啊。

读取数据库日期,属于不动脑的。

日期比较函数  datediff  具体用法,baidu.com

[ 本帖最后由 ysf0181 于 2013-11-25 15:37 编辑 ]

ASP讨论QQ群:251346273
2013-11-25 15:32
快速回复:高手给看看怎么实现一小时一个ip只能投一票
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.017147 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved