<%
'================================
' function list:
' 1: Establish a connection to the database Connopen (databaseconnectstr,dbtype,conn_object)
' 2: Disconnect the database Connclose (conn_object)
' 3: Prevent SQL injection Saferequest (paraname,paratype)
' 4: Format date DateFormat (datestr,datetype)
' 5: Display error hint Showerr ( ERRSTR)
' 6: Specific data in query string Selectstr (contentstr,patternstr,patternnum)
' 7: Filter specified character Leach (contentstr,badwords)
' 8: Remote file content crawl seize (urlstr)
' 9: Data stream encoding processing bytestobstr (body,cset)
' 10: Encoding Cookies Codecookie (CONTENTSTR)
' 11: Decode Cookies Decodecookie (CONTENTSTR)
' 12: Verify that the data submission source is legitimate chkpost ()
' 13: Personalized encryption Myencrypt (strpassword)
' 14: Prohibit browser caching this page nobuffer ()
' 15: Web page formatted input text HTMLEncode (fstring)
' 16: The specified length of the intercept string from the head (by number of characters) Gottopic (Str,strlen)
' 17: Detect authentication Code Checkradompass (radompass)
' 18: Generate Authenticode Code getcode ()
' 19: Get client operating system version Getsystem ()
' 20: Database transaction processing Connmanage (Conn_object)
' 21: Quick sort (recursive) QuickSort (arr,low,high)
' 22: Add the elements of an array to a specific string Arr_join (arr,character)
' 23: Number of strings separated by a delimiter Count_character (str,character)
' 24: Intercepting a specified number in a string containing a separatorString Inter_str_by_character_num (Str,character,start,num)
' 25: Download file with Stream DownloadFile (strfile)
' 26: Return information Send_back (resultwords)
' 27: Get error message Get_err ()
' 28: Opposite Saferequest saferesponse (content)
' 29: Save remote picture Saveremotefile (localfilename,remotefileurl)
' 30: ...
Dim Language_arr
Language_arr (0) = "Database connection parameter setting error!" "
Language_arr (1) =" Database connection type parameter setting Error! "
Language_arr (2) =" Database connection Failed! "
Language_arr (3) =" Invalid parameter value! "
Language_arr (4) =" parameter value is not a valid date format! "
Language_arr (5) =" Operation failed! "
Language_arr (6) =" column has duplicate name! "
Language_arr (7) =" Column name is empty! "
Language_arr (8) =" Column folder creation failed! "
Language_arr (9) =" You do not have this permission! The
'
function id:1
Function: Establishing a connection to the database
' Modify time:
' descendant parameters:
' connectstr: Database connection string
' Connecttype: Database category-Number font, 0 is access,1 for MS SQL
return value:
'
Sub Connopen (Databaseconnectstr,dbtype,conn_object)
Set conn_object = Server.CreateObject ("Adodb.connection")
If Databaseconnectstr = "" Then call Showerr (Language_arr (0))
If DBType = 0 Then
Conn_object. Open "Driver={microsoft Access driver (*.mdb)};d bq=" & Databaseconnectstr
ElseIf DBType = 1 Then
Conn_object. Open "Provider=SQLOLEDB.1;" & Databaseconnectstr
Else
Call Showerr (Language_arr (1))
End If
Err.Clear
End Sub
'
' Function id:2
' Function: Disconnect the database
' Modify Time:
' Descendant parameters:
' Return value:
'
Sub Connclose (Conn_object)
Conn_object.close
Set conn_object = Nothing
End Sub
'
' Function Id:3
' Function action: Prevent SQL injection
' Modify Time:
' Descendant parameters:
' Paraname: Parameter name-character type
' Paratype: Parameter Type-numeric (1 indicates that the above parameter is a number, and 0 indicates that the above parameter is a character)
' Return value:
' The filtered string
'
Function saferequest (paraname,paratype)
Dim Paravalue
Paravalue = Request (paraname)
Select Case Paratype
Case 0
paravalue = replace (Paravalue, "'", "[system:34]")
paravalue = replace (paravalue, "=", "[system:61]")
Case 1
if not isnumeric (paravalue) then call Showerr (Language_arr (3))
case-1
if not isnumeric (paravalue) then call Showerr (Language_arr (3))
If Paravalue = "" Then Paravalue = 0
Case Else
If Len (paravalue) > Paratype then call Showerr (Language_arr (3))
paravalue = replace (Paravalue, "'", "[system:34]")
paravalue = replace (paravalue, "=", "[system:61]")
End Select
saferequest = Paravalue
End Function
' =============================== ' function Id:4
' function: Format Date
' Modify time:
' descendants parameter:
' datestr: Date string
' paratype: Date type-Digital
' return value:
' formatted date
Function DateFormat (Datestr,datetype)
Dim datestring
if IsDate (datestr) = False then
Call Showerr (Language_arr (4))
End If
Select Case Datetype
case "1"
datestring = year (DATESTR) & "-" &month (DATESTR) & "-" &day (DATESTR)
case "2"
datestring = year (DATESTR) & "." &month (DATESTR) & "." &day (DATESTR)
case "3"
datestring = year (DATESTR) & "/" &month (DATESTR) & "/" &day (DATESTR)
case "4"
datestring = Month (DATESTR) & "/" &day (DATESTR) & "/" &year (DATESTR)
case "5"
datestring = Day (DATESTR) & "/" &month (DATESTR) & "/" &year (DATESTR)
case "6"
datestring = Month (DATESTR) & "-" &day (DATESTR) & "-" &year (DATESTR)
case "7"
datestring = Month (datestr) & "." &day (DATESTR) & "." &year (DATESTR)
case "8"
datestring = Month (DATESTR) & "-" &day (DATESTR)
case "9"
datestring = Month (DATESTR) & "/" &day (DATESTR)
case "10"
datestring = Month (datestr) & "." &day (DATESTR)
case "11"
datestring = Month (DATESTR) &language_arr (6) &day (DATESTR) &language_arr (7)
case "12"
datestring = Day (datestr) &language_arr (7) &hour (DATESTR) &language_arr (8)
case "13"
datestring = Day (datestr) &language_arr (7) &hour (DATESTR) &language_arr (8)
case "14"
datestring = Hour (DATESTR) &language_arr (8) &minute (DATESTR) &language_arr (9)
case "15"
datestring = Hour (datestr) & ":" &minute (DATESTR)
case "16"
datestring = year (DATESTR) &language_arr (5) &month (DATESTR) &language_arr (6) &day (DATESTR) & Language_arr (7)
Case Else
datestring = Datestr
End Select
DateFormat = datestring
End Function
'
' function Id:5
' function: Display error hint
' Modify time:
' descendants parameter:
' ERRSTR: Error hint-character type
' Return value: Return to submit page
'
Sub Showerr (ERRSTR)
Response.Write ("<script>alert" "" &errStr& "" "); location.href=" "Javascript:history.back ()" "; </ Script> ")
Response.End
End Sub