ASP special character filtering

Source: Internet
Author: User

Author: Gu Jian

Ah, I haven't written anything for a long time. This time, the teacher asked me to test my own things again and found that the filtering of special characters is lax, therefore, a function is rewritten to filter out special characters.

Function chkinvaildword (words)
Const invaildwords = "select | update | Delete | insert | @ | -- |," 'must be separated by "|". The final character must be |

Chkinvaildword = true
Invaildword = Split (invaildwords, "| ")
Inwords = lcase (TRIM (words ))

For I = lbound (invaildword) to ubound (invaildword)
If instr (inwords, invaildword (I)> 0 then
Chkinvaildword = true
Exit Function
End if
Next
Chkinvaildword = false
End Function

It is relatively simple and you will not be able to use it.

However, I was prepared to use for each... next at the beginning, but I don't know why it is wrong. So I switched to the for loop instead, and I felt uncomfortable, but I can use it!
(PS: Today, I have a headache for a whole day. I don't know when the damn headache will be good. Otherwise, I will be ruined by tomorrow's work! We look forward to a good situation tomorrow !)

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.