ASP simple to prevent external submissions

Source: Internet
Author: User
Tags servervariables trim

' ****************************************************
  ' function name: chkpost
  ' for   use: Prohibit outbound submission of form
  ' return value: True station submitted, outside Flase station
  ' ****************************************************
  public Function chkpost ()
   Dim url1,url2
   chkpost=true
   url1=cstr ( Request.ServerVariables ("Http_referer"))
   url2=cstr (Request.ServerVariables ("SERVER_NAME"))
   If Mid (Url1,8,len (URL2)) <>url2 and InStr (URL1, "dl.loupan.com") = 0 Then
  chkpost= False
  exit function
   end If
  End Function

  ' ****************************************************
  function name: GETURL
  ' for   Use: Get URL including parameter
  ' return value: Get URL including parameter
  ' ****************************************************
  Public Function GetUrl ()   
   Dim strtemp    
   strtemp= Request.ServerVariables ("Script_name")      
   if  Trim ( request.querystring) <> "" Then
    strtemp=strtemp& "?"
    for each m_item in request.querystring
  strTemp=strTemp&M_item& "=" &server.urlencode (Trim (Request.QueryString ("&M_item&"))
    next
    End If
   geturl=strtemp  
  End Function
 
  ' Prevent external submission usage
 call chkpost () '
 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.