Expert recommended more useful ASP function set _ Application Tips

Source: Internet
Author: User
Now do not write ASP, this time I will I deposited some of the functions of the library to share to everyone, hope to give beginners enlightenment, to veteran also help it, thank you for your support!
<% @LANGUAGE = "VBSCRIPT" codepage= "936"%>
<%
Starttime=timer () ' Program Execution time detection
'###############################################################
' ┌──vibo───────────────────┐
' │vibo STUDIO Copyright │
' └───────────────────────┘
' Author:vibo
' Email:vibo_cn@hotmail.com
'-----------------Vibo ASP site to develop common function libraries------------------
' Opendb (vdata_url)--------------------Open the database
' GetIP ()-------------------------------Get real IP
' Getipadress (SIP)------------------------find the real address of the IP corresponding
' Ip2num (SIP)----------------------------restrict a segment of IP address
' Chkfrom ()------------------------------Anti-stop outbound submission settings
' Getsys ()-------------------------------Operating system detection
' Getbrowser ()---------------------------Browser version detection
' Getsearcher ()--------------------------Identify search engines
'
'----------------------Data filter ↓----------------------------
' Checkstr (byVal chkstr)-----------------check for invalid characters
' Checksql ()-----------------------------Prevent SQL injection
' Uncheckstr (STR)-------------------------Check for illegal SQL commands
' Checkstr (STR)--------------------------ASP Latest SQL anti-injection filtering culvert number
' HTMLEncode (restring)-------------------Filter Transform HTML code
' Datetostr (datetime,showtype)-----------Date conversion function
' Date2chinese (Idate)--------------------get ASP's Chinese date string
' Lenstr (str)----------------------------compute string Length (bytes)
' Createarr (str)-------------------------generate two-dimensional arrays
' Showrsarr (rsarr)-----------------------table structure that displays recordset GetRows generated array in a table
'----------------------an external component uses the function ↓------------------------
' SendMail (to_email,from_email,from_name,mail_subject,mail_body,mail_htmlbody)-----' JMail component Send mail
'-----------------------------------------system detection function ↓------------------------------------------
' Isvalidurl (URL)------------------------detect if a Web page is valid
' Gethtmlpage (filename)------------------get the contents of the file
' Checkfile (FilePath)--------------------Check if a file exists
' Checkdir (folderpath)-------------------Check if a directory exists
' Makenewsdir (foldername)----------------generate directory based on specified name
' Createhtmlpage (filename,filedata,c_mode) Generate files
' Checkbadword (byVal chkstr)-------------filter Dirty Word
'###############################################################
Dim Ipdata_url
Ipdata_url= "./ip.mdb"
Response.Write ("--------------Client Information detection------------" & "<br>")
Response.Write (Getsys () & "<br>")
Response.Write (Getbrowser () & "<br>")
Response.Write (Getsearcher () & "<br>")
Response.Write ("IP:" &getip () & "<br>")
Response.Write ("Source:" & (Getipadress (GetIP ()) & "<br>")
Response.Write ("<br>")
Response.Write ("--------------Data submission Detection--------------" & "<br>")
If not Chkfrom then
Response.Write ("Please do not submit content from outside the station!") "&" <br> ")
Response.End
Else
Response.Write ("Content of this site!") "&" <br><br> ")
End If
function Opendb (Vdata_url)
'------------------------------Open the database
' Use: Conn = opendb ("Data/data.mdb")
Dim Vibo_conn
Set vibo_conn= Server.CreateObject ("ADODB.") Connection ")
vibo_conn.connectionstring= "Provider=Microsoft.Jet.OLEDB.4.0;Data source=" & Server.MapPath (Vdata_url)
Vibo_conn.open
Opendb=vibo_conn
End Function
function GetIP ()
'-----------------------Get real IP
Userip = Request.ServerVariables ("Http_x_forwarded_for")
If Userip = "" Then Userip = Request.ServerVariables ("REMOTE_ADDR")
Getip=userip
End Function

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.