请教个asp小程序,判断一天,24小时内,发布信息数不能大于5怎么写,请高手帮忙

来源:百度知道 编辑:UC知道 时间:2024/06/21 04:25:05
请教下高人,我有个文章发布版块,给注册用户提交
结果好多广告,一次性发上百个帖子,晕死了
我想写个判断,一个IP地址,一天,24小时内最多只能发5个帖子,多出来,提示,一天只能发5条,该怎么写呢,请大侠帮忙!加分
部分程序入下
<%
if session("anjule_username")="" then
response.Redirect "login.asp"
response.End()
end if
%>

<%
if request("action")="save" then
username=session("anjule_username")
title=trim(request("title"))
content=trim(request("content"))
rs2.close
set rs2=nothing %>

sql="select count(*) as count form [table] where ip='121.121.110.211' and datediff('d',now(),'日期字段')<1"

……'执行代码
if rs["count"]>4 then
Response.Write "别再写了啊,再写我打你了"
Respone.End
end if

既然已经是注册用户了,直接判断同一个用户名在同一个IP下在24小时内只能发5条即可,如果是限制IP的话。

countnum=conn.execute("select count(*) from 文章表 where username='"&session("anjule_username")&"' and IP='192.168.1.1' and datediff('d',now(),'文章发布日期')=0")(0)

if countnum>5 then
response.write "已经超过了发布文章限制"
end if

你可以给用户组添加一个字段 如time,发表的同时.将发表的时间记录进去
然后判断现在的时间-那个时间是否大于24小时.

就是楼上的那个意思 多说无益