ASP Practical Function Library Source Code

xiaoxiao2021-03-06  40

ASP Practical Function Library Source Code

<% 'Judging whether the file name is legal function isfilename (AfileName) DIM SERRORSTR, INAMALRORSTR = Array ("/", "/", ":", "*", "?", "" "", " <","> "," | ") INAMALELENGTH = LEN (AfileName) if inamelength = null dam1filename = false = false for i = 0 to 8 if instruction IF NEXTEND IFEND FUNCTION

'Continuous Enter and Spaces of the String Tail Function Trimvbcrlf (STR) Trimvbcrlf = RtrimVBCRLF (Ltrimvbcrlf (STR)) End Function

'Continuous carriage return and space of the start of string and space Function Ltrimvbcrlf (STR) DIM POS, isblankcharpos = 1isblankchar = truewhile isblankchar if MID (Str, POS, 1) = "" THEN POS = POS 1 Elseif MID (Str, POS , 2) = VBCRLF THEN POS = POS 2 else isblankchar = false end ifwendltrimvbcrlf = Right (STR, LEN (STR) -POS 1) End Function

'Continuous carriage return and space of the string of strings and space Function RTrimvbcrlf (STR) DIM POS, isblankcharpos = len (str) isblankchar = truewhile isblankchar and pos> = 2 if MID (Str, POS, 1) = "" "" " POS-1 elseif MID (STR, POS-1, 2) = VBCRLF THEN POS = POS-2 else isblankchar = false end ifwendrtrimvbcrlf = RTRIM (Left (STR, POS)) End Function

'Judging whether Email is valid, return 1 Represents the correct function ISEMAIL (AEMAIL) DIM ILOCAT, V, ILENGTH, I, CheckletterIF INSTR (AEMAIL, "@") = 0 or ISEMAIL, ") = 0 Then ISEMAIL = 0 EXIT FUNCTIONEND IFILOCAT = IF INSTR (iLocat, Aemail, ".") = 0 or Instr (iLocat 1, Aemail, "@")> 0 Then ISEmail = 0 exit functionend ifif Left (AEMAIL , 1) = "." Or right (aEmail, 1) = "." Or left (aEmail, 1) = "@" Or right (aEmail, 1) = "@" Then isEmail = 0 EXIT FUNCTIONEnd Ifv = "1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_ -. @ "inength = len (aemail) for i = 1 to ionch checkletter = MID (AEMAIL, I, 1) IF INSTR (v, checkletter) = 0 Then ISEMAIL = 0 exit function end ifnextisemail = 1END function 'test: display server information Sub showServerDim nameResponse.write "

" for each name in request.servervariables Response.write "" Response.write "
" & name & " "Response.write" "& required.servervariables (name) &"
"response.write" "Next" "" "End Sub

'Test: Display RS Results and Field Name Sub Showrs (RS) DIM STRTABLE, WHATEVERRESPONSE.WRITE "

" for Each Whate In Rs.fields Response.write "
"& wrote .Name &" "NextStable ="
"& rs.getstring (," ","
, "" "" "Response.write (start) End Sub 'Displays text Function TXT2HTML (STR) with HTML format If ISNULL (STR) THEN TXT2HTML = "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" " , ">") Str = Replace (STR, CHR (13) CHR (10), "
") Str = Replace (Str, Chr (9), "") str = Replace (Str, ", "") txt2html = streven function

'Test: Display Debug Error Message Sub Showerdim SerrmsgSerrmsg = Err.Source & "&" & Err.DescriptionResponse.write "

" & Serrmsg & "" Err.clearend Sub

'Display text counter Sub showCounterDim fs, outfile, filename, countfilename = server.mappath ( "count.txt") Set fs = CreateObject ( "Scripting.FileSystemObject") If fs.fileExists (filename) ThenSet outfile = fs.openTextFile (filename , 1) count = outfile.readlinecount = count 1Response.write "

Visitor:" & count & "
" outfile.closeSet outfile = fs.CreateTextFile (filename) outfile.writeline (count) ElseSet outfile = fs. OpenTextFile (filename, 8, true) count = 0outfile.writeline (count) end ifoutfile.closset fs = nothingnd sub%>

转载请注明原文地址:https://www.9cbs.com/read-52314.html

New Post(0)
CopyRight © 2020 All Rights Reserved
Processed: 0.035, SQL: 9