ASP Function in common use 1

Source: Internet
Author: User
' =======================


' detects if the page is submitted from this site


' Back: True,false


' =======================


Function Isselfrefer ()


Dim shttp_referer, Sserver_name


shttp_referer = CStr (Request.ServerVariables ("Http_referer"))


sserver_name = CStr (Request.ServerVariables ("SERVER_NAME"))


If Mid (shttp_referer, 8, Len (sserver_name)) = Sserver_name Then


Isselfrefer = True


Else


Isselfrefer = False


End If


End Function


'*****************************


' Create a file directory


'*****************************


Dim Fs,newpath,delpath,fpath,delfpath


Function Fsfolder (tname)


Newpath=server.mappath ("&Tname&")


Set fs=server.createobject ("Scripting.FileSystemObject")


If fs.folderexists (newpath) =true Then


Response.Write "<script language= ' JavaScript ' >" &_


"alert (Please rename ' folder name ');" &_


"History.go (-1);" &_


"</script>"


Response.End


Else


Fs.createfolder (NewPath)


Set fs=nothing


End If


End Function


'*****************************


' Delete file directory


'*****************************


Function Delfolder (tname)


Delpath=server.mappath ("&TName&")


Set fs=server.createobject ("Scripting.FileSystemObject")


If fs.folderexists (delpath) =true Then


Fs.deletefolder delpath,true


End If


Set fs=nothing


End Function


'***************************************


' Create file


'***************************************


Function CreateFile (fname,strfile)


Dim Fpath,os,fs


Fpath=server.mappath ("&FName&")


Set fs=server.createobject ("Scripting.FileSystemObject")


Set os=fs.createtextfile (fpath,true,false)


Os.write strfile


Os.close


Set os=nothing


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.