asp实现防止站外提交内容的两个方法

2018-09-06 11:29

阅读:472

  方式一:
复制代码 代码如下:<%
FunctionIsSelfRefer()
DimformUrl,relUrl
formUrl=LCase(Trim(request.ServerVariables(HTTP_REFERER)))
IfformUrl=Then
IsSelfRefer=False
Else
relUrl=
If(formUrl<>relUrl)Then
IsSelfRefer=False
Else
IsSelfRefer=True
EndIf
EndIf
EndFunction
%>
方式二:
复制代码 代码如下:<%
FunctionIsSelfRefer()
DimsHttp_Referer,sServer_Name
sHttp_Referer=CStr(Request.ServerVariables(HTTP_REFERER))
sServer_Name=CStr(Request.ServerVariables(SERVER_NAME))
IfMid(sHttp_Referer,8,Len(sServer_Name))=sServer_NameThen
IsSelfRefer=True
Else
IsSelfRefer=False
EndIf
EndFunction
%>


评论


亲,登录后才可以留言!