日期:2011-08-04  浏览次数:20772 次

 本文例举了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