close
ASP的兩個簡單的檢測外部提交函數
兩個簡單的檢測外部提交函數的例子,第一個函數是ChkPost(),它可以檢測使用者當前所在伺服器名是否存在於來源頁面,第二個函數是PostCheck(),它可以通過很簡單的檢測,看看提交是否為POST方式。
函數ChkPost()
檢測使用者當前所在伺服器名是否存在於來源頁面
程式碼如下: Function ChkPost()
dim server_v1,server_v2
chkpost=False
server_v1=Cstr(Request.ServerVariables("HTTP_REFERER"))
server_v2=Cstr(Request.ServerVariables("SERVER_NAME"))
If Mid(server_v1,8,Len(server_v2))<>server_v2 Then
chkpost=False
Else
chkpost=True
End If
End function
函數PostCheck()
很簡單的檢測,就是檢測提交是否為POST方式
程式碼如下: Function PostCheck()
PostCheck=False
If Lcase(Request.ServerVariables("Request_Method"))="post" Then PostCheck=True
End Function
全站熱搜