
ASP留言板IP或IP段限制與限制留言次數
<%
'留言板IP限制程序
dim ips
ips = left(Request.ServerVariables("REMOTE_ADDR"),15)
response.write ips
IpLists = "127.0.|"
function isForbid(sip)
dim Iplist,Iparr,Ipi
Iplist = "|"& IpLists &"|" '
Iparr = split(Iplist,"|") '生成數組
for Ipi = 0 to ubound(Iparr) '循環查找數組IP
if len(Iparr(Ipi)) > 0 and instr("|" & sip,"|" & Iparr(Ipi)) > 0 then
isForbid = true
exit function
end if
next
isForbid = false
end function
if isForbid(ips) then
Response.write "<p align=""center"">你沒有留言的權限</p>"
else
response.write "aaaaaaaaaa"
end if
'驗證兩次留言時間間隔 方法 01
'PostIntervalTime = 5*60 '同一個IP多長時間可以留一次言,單位是秒,5分鐘可以用5*60表示,不限制請設置為0
PostIntervalTime = 1*60
if int(PostIntervalTime) > 0 then
newDate = Dateadd("s",int(PostIntervalTime)*-1,Now)
Set rs = conn.execute("select top 1 ip from qwbmbook where ip = '"& fixsql(ip) &"' and time > #"& newDate &"#")
if not (rs.eof and rs.bof) then
set rs = nothing
conn.close
set conn = nothing
'er "請不要頻繁留言,請等分鐘"& int(PostIntervalTime/60) &"留言!",""
end if
set rs = nothing
end if
%>
您發布的評論即表示同意遵守以下條款:
一、不得利用本站危害國家安全、泄露國家秘密,不得侵犯國家、社會、集體和公民的合法權益;
二、不得發布國家法律、法規明令禁止的內容;互相尊重,對自己在本站的言論和行為負責;
三、本站對您所發布內容擁有處置權。