j=BufferSize-1 To 1 Step -1
IPArr(j+1)=IPArr(j)
Next
End Sub
Private Function GetIP()
Dim strIPAddr
If Request.ServerVariables("HTTP_X_FORWARDED_FOR") = "" OR InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), "unknown") > 0 Then
strIPAddr = Request.ServerVariables("REMOTE_ADDR")
ElseIf InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), ",") > 0 Then
strIPAddr = Mid(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), 1, InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), ",")-1)
ElseIf InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), ";") > 0 Then
strIPAddr = Mid(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), 1, InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), ";")-1)
Else
strIPAddr = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
End If
GetIP = (Trim(Mid(strIPAddr, 1, 30)))
End Function
End Class
%>
asp防止刷新
复制代码 代码如下:
Sub chkreflash()
dim ScriptName
ScriptName=lcase(request.ServerVariables("PATH_INFO"))
dim posttime,DoReflashPage,ReflashPage,SplitReflashPage
posttime=1 ''防止刷新时间
DoReflashPage=false
ReflashPage="|Article_one.asp"
SplitReflashPage=split(ReflashPage,"|")
for i=0 to ubound(SplitReflashPage)
if instr(scriptname,SplitReflashPage(i))>0 then
DoReflashPage=true
exit for
end if
next
if (not isnull(session("ReflashTime"))) and posttime>0 and DoReflashPage then
if DateDiff("s",session("ReflashTime"),Now())<posttime then
call msg("警告!系统已记录您的IP,和刷新次数。\n\n请不要在"&posttime&"秒内连续刷新本页面!","-1")
else
session("ReflashTime")=Now()
end if
elseif isnull(session("ReflashTime")) and posttime>0 and DoReflashPage then
Session("ReflashTime")=Now()
end if
End Sub
调用方法在页面首部加入chkreflash即可