Anti-SQL FUNCTIONS OF NB leaf

Source: Internet
Author: User

Program code:
Function section ===================================================== ========================================
------------------------------------------------
Purpose: Check whether a number exceeded the range.
Input: Check the character, pass the value (0 directly, 1 take Form, 2 take QueryString, 3 take cookies, 4 directly Reqeust), start number (default number ), end number (-1, the size is not checked)
Function CheckNum (str_str, int_quest, int_startnum, int_endnum)
Mystr = Trim (str_str)
Select Case int_quest
Case 1
Istr = Request. Form (mystr)
Case 2
Istr = Request. QueryString (mystr)
Case 3
Istr = Request. Cookies (mystr)
Case 4
Istr = Request (mystr)
Case Else
Istr = mystr
End Select
Istr = Left (istr, 32)
If IsNumeric (istr) Then
INum = CDbl (istr)
Else
INum = int_startnum
End If
If int_endnum>-1 Then
If iNum <int_startnum Then iNum = int_startnum
If iNum> int_endnum Then iNum = int_endnum
End If
CheckNum = iNum
End Function
------------------------------------------------
Purpose: Check the filter string.
Input: String, pass value (0 directly, 1 get Form, 2 get QueryString, 3 get cookies, 4 directly Reqeust), check method (1 do not filter html, 2 pure html, 3 title filtering, 4 other html filtering,), character segment truncation Length
Function CheckStr (str_str, int_quest, int_type, int_strlen)
Mystr = str_str
Select Case int_quest
Case 1
Istr = Request. Form (mystr)
Case 2
Istr = Request. QueryString (mystr)
Case 3
Istr = Request. Cookies (mystr)
Case 4
Istr = Request (mystr)
Case Else
Istr = mystr
End Select
Istr = "" & Trim (istr)
Istr = Replace (istr ,"","")
Select Case int_type
Case 1
Istr = Replace (istr, CHR (32), "& nbsp ;")
Istr = Replace (istr, CHR (9), "& nbsp ;")
Istr = Replace (istr, CHR (10) & CHR (10), "</P> <P> ")
Istr = Replace (istr, CHR (10), "<BR> ")
Istr = Replace (istr, CHR (13 ),"")
Case 2
Istr = istr
Case 3
Istr = Replace (istr, CHR (32), "& nbsp ;")
Istr = Replace (istr, CHR (9), "& nbsp ;")
Istr = Replace (istr, CHR (13 ),"")
Istr = Replace (istr, "<", "& lt ;")
Istr = Replace (istr, ">", "& gt ;")
Istr = Replace (istr, CHR (34), "& quot ;")
Istr = Replace (istr, "", "& nbsp ;")
Istr = Replace (istr, CHR (39), "& #39 ;")
Case Else
Istr = Replace (istr, CHR (32), "& nbsp ;")
Istr = Replace (istr, CHR (9), "& nbsp ;")
Istr = Replace (istr, CHR (10) & CHR (10), "</P> <P> ")
Istr = Replace (istr, CHR (10), "<BR> ")
Istr = Replace (istr, CHR (13 ),"")
Istr = Replace (istr, "<", "& lt ;")
Istr = Replace (istr, ">", "& gt ;")
Istr = Replace (istr, CHR (34), "& quot ;")
Istr = Replace (istr, "", "& nbsp ;")
Istr = Replace (istr, CHR (39), "& #39 ;")
End select
Istr = CutStr (istr, int_strlen ,"")
CheckStr = istr
End Function
------------------------------------------------
Purpose: intercept a string.
Input: String, truncation length of character segments, more than part of Characters
Function CutStr (str_str, int_strlen, str_addtrr)
Dim k, I
K = 0
For I = 1 to Len (str_str)
C = Abs (Asc (Mid (str_str, I, 1 )))
If c & gt; 255 Then
K = k + 2
Else
K = k + 1
End If
If k> = int_strlen Then Exit
Next
CutStr = Left (str_str, k) & str_addtrr
End Function

 

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.