200分求 帮写一段asp小代码。。

来源:百度知道 编辑:UC知道 时间:2024/05/18 17:54:36
200虽然有点少。但请帮帮偶咯,万分感谢。
程序大概是。记录IP来访。
假如该IP第一次来访。记录该IP并记录入数据库,然后继续运行。
假如该IP 一段时间内(2小时)继续访问,那么就跳转出错页面。

如果可以的话。请加偶。616169406 注明 asp程序。谢谢哦

dim IP
if Request.ServerVariables("HTTP_X_FORWARDED_FOR")="" then
IP=Request.ServerVariables("REMOTE_ADDR")
else
IP=Request.ServerVariables("HTTP_X_FORWARDED_FOR")
end if
'获取IP

set rs = conn.execute("select ip from ips where ip ='"&IP&"'")
if not rs.eof then
'IP已经存在,跳转
else
'IP不存在,允许访问
end if

dim times
'然后是时间,可以用年加月加日加小时生成一个数字
'然后把times减去超时的时间
conn.execute("delete * from ips where time>"×&"")
'删除超时的用户,使得允许他们再次访问

我有一个人人的ASP网站
也许对你有用~里面包含了你所需要的东西~呵呵~