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 

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 11 的頭像
    11

    冠霖的部落格

    11 發表在 痞客邦 留言(0) 人氣()