Common ASP custom set of functions

Source: Internet
Author: User
Tags exit chr copy functions net
function | Function Article source: Viewpoint Design 8see.net
http://blog.8see.net/
REM---form hint function being-----------------------------
CODE Copy ...
Function Check_submit (STR,RESTR)
If str= "" Then
Response.Write "<script>"
Response.Write "Alert (' &restr&"); "
Response.Write "History.go (-1)"
Response.Write "</script>"
Response.End
Else
Check_submit=str
End If
End Function


CODE Copy ...
Function Alert_submit (str)
Response.Write "<script>"
Response.Write "Alert (' &str&"); "
' Response.Write ' Location.reload ();
Response.Write "</script>"
End Function


CODE Copy ...
Function Localhost_submit (Str,urls)
Response.Write "<script>"
If str<> "" Then
Response.Write "Alert (' &str&"); "
End If
Response.Write "Location= '" &urls& "';"
Response.Write "</script>"
End Function


REM---Generate custom bit random number being-----------------------------
CODE Copy ...
Function Makerndid (ByVal maxlen)
Dim Strnewpass
Dim Whatsnext, Upper, lower, intcounter
RANdomize
For intcounter = 1 to MaxLen
whatsnext = Int (2 * Rnd)
If whatsnext = 0 Then
Upper = 80
Lower = 70
Else
Upper = 48
Lower = 39
End If
Strnewpass = Strnewpass & Chr (Int (upper-lower + 1) * Rnd + Upper))
Next
Makerndid = Strnewpass
End Function


REM---generates four-bit random number being-----------------------------
CODE Copy ...
Function Get_rand ()
Dim num1
Dim rndnum
Randomize
Do While Len (Rndnum) <4
Num1=cstr (CHR (57-48) *rnd+48)
Rndnum=rndnum&num1
Loop
Get_rand=rndnum
End Function


REM---Determine whether the data is integral type being-----------------------------
CODE Copy ...
Function Isinteger (para)
On Error Resume Next
Dim str
Dim l,i
If ISNULL (para) Then
Isinteger=false
Exit function
End If
STR=CSTR (para)
If trim (str) = "" Then
Isinteger=false
Exit function
End If
L=len (str)
For I=1 to L
If Mid (str,i,1) > "9" or mid (str,i,1) < "0" then
Isinteger=false
Exit function
End If
Next
Isinteger=true
If Err.number<>0 then Err.Clear
End Function


REM---database link function being-----------------------------
CODE Copy ...
Function Openconn
Set conn = Server.CreateObject ("ADODB. Connection ")
Connstr= "Provider=Microsoft.Jet.OLEDB.4.0;Data source=" & Server.MapPath (Db_login)
Conn. Open ConnStr
End Function


REM---character uncode code function being-----------------------------
CODE Copy ...
Function urlencoding (Vstrin)
Strreturn = ""
For i = 1 to Len (Vstrin)
THISCHR = Mid (vstrin,i,1)
If Abs (ASC (THISCHR)) < &hff Then
Strreturn = Strreturn & THISCHR
Else
Innercode = ASC (THISCHR)
If Innercode < 0 Then
Innercode = Innercode + &h10000
End If
Hight8 = (Innercode and &hff00) \ &hff
Low8 = Innercode and &hff
Strreturn = strreturn & "%" & Hex (HIGHT8) & "%" & Hex (LOW8)
End If
Next
urlencoding = Strreturn
End Function


REM---HTML filter function being-----------------------------function htmlout (str)
CODE Copy ...
Dim result
Dim l
If IsNULL (str) Then
Htmlout= ""
Exit function
End If
L=len (str)
Result= ""
Dim i
For i = 1 to L
Select Case Mid (str,i,1)
Case "<"
Result=result+ "<"
Case ">"
result=result+ ">"
Case Chr (13)
If session ("Admin_system") = "" Then
result=result+ "<br>"
End If
Case Chr (34)
result=result+ "" "
Case "&"
result=result+ "&"
Case Chr (32)
' Result=result+ ' "
If I+1<=l and i-1>0 then
If Mid (str,i+1,1) =CHR (m) or mid (str,i+1,1) =CHR (9) or mid (str,i-1,1) =CHR (OR)



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.