求在ASP中限制用户发布信息次数的代码

来源:百度知道 编辑:UC知道 时间:2024/06/13 13:58:15
<input type=button id=updataall name=updataall value="重新发布所有信息" onClick="window.location='updataall.asp'"> 通过这个按钮提交数据
这是updataall.asp代码
<%if userflag2=0 then
response.redirect"ok.asp?action=flag"
end if
function box(msg,addr)
response.write "<script language='javascript'>"
response.write "alert('"&msg&"');"
response.write "location.href='"&addr&"';"
response.write "</script>"
end function
times=now()
ldate=360
lastdate=now()+ldate
Set rs = Server.CreateObject("ADODB.RecordSet")
rs.ActiveConnection = conn
rs.CursorType =1
rs.LockType =3
rs.Source = "select * from SMT_sca where SMT_yp_id="&session("id")&" order by SMT_id desc"
rs.Open
if not (rs.bof or rs.eof) then
new

给你个提示!
用户提交留言的时候,用Rs.RecordCount 来计算 该用户提交的记录数

然后返回的判断Rs.RecordCount>3的时候,弹出信息。

最后再做一个字段,写入时间

用来判断用户一天或者(自己定)来修改数据库中的值,初始化记录数Rs.RecordCount为0

就可以达到用户一天内只能对一条记录(一个标题)回复3次。