Share a piece of ASP form verification code
The code is as follows
<% '================================================= 'Lonz 通用函数 '================================================= '含汉字的字符串长度 function strlen(str) dim p_len p_len=0 strlen=0 if trim(str)<>"" then p_len=len(trim(str)) for xx=1 to p_len if asc(mid(str,xx,1))<0 then strlen=int(strlen) + 2 else strlen=int(strlen) + 1 end if next end if end function '最大字符数;超过返回true,否则返回false;maxnum:最大字符数,strmaxnum:字符 function bymaxnum(maxnum,strmaxnum) if len(strmaxnum)>maxnum then bymaxnum=true else bymaxnum=false end if end function '最小字符数;超过返回true,否则返回false;maxnum:最大字符数,strmaxnum:字符 function byminnum(minnum,strminnum) if len(strminnum)<minnum then byminnum=true else byminnum=false end if end function '检查输入不全为或不为汉字,返回true,否则返回false function isnotcs(strcs) dim getcs for cp=1 to len(strcs) getcs=mid(strcs,cp,1) if asc(getcs)>=0 then isnotcs=true exit function end if isnotcs=false next end function '是否为非email地址;为非email地址返回true,否则返回false;判断条件:是否含有“@” function IsnotEmail(email) dim names, name, i, c IsnotEmail = false names = Split(email, "@") if UBound(names) <> 1 then IsnotdEmail = true exit function end if for each name in names if Len(name) <= 0 then IsnotEmail = true exit function end if for i = 1 to Len(name) c = Lcase(Mid(name, i, 1)) if InStr("abcdefghijklmnopqrstuvwxyz_-.", c) <= 0 and not IsNumeric(c) then IsnotEmail = true exit function end if next if Left(name, 1) = "." or Right(name, 1) = "." then IsnotEmail = true exit function end if next if InStr(names(1), ".") <= 0 then IsnotEmail = true exit function end if i = Len(names(1)) - InStrRev(names(1), ".") if i <> 2 and i <> 3 then IsnotEmail = true exit function end if if InStr(email, "..") > 0 then IsnotEmail = true end if end function '包含非法字符;只允许英文字母,数字,"-","_","." function havespchar(strspchar) havespchar = false dim sp,csp for sp = 1 to Len(strspchar) csp = Lcase(Mid(strspchar, sp, 1)) if InStr("abcdefghijklmnopqrstuvwxyz_-.", csp) <= 0 and not IsNumeric(csp) then havespchar = true exit function end if next end function %>
The above is the detailed content of Share a piece of ASP form verification code. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



PHP is a very popular programming language, and CodeIgniter4 is a commonly used PHP framework. When developing web applications, using frameworks is very helpful. It can speed up the development process, improve code quality, and reduce maintenance costs. This article will introduce how to use the CodeIgniter4 framework. Installing the CodeIgniter4 framework The CodeIgniter4 framework can be downloaded from the official website (https://codeigniter.com/). Down

How to use Flask-WTF to implement form validation Flask-WTF is a Flask extension for handling web form validation. It provides a concise and flexible way to validate user-submitted data. This article will show you how to use the Flask-WTF extension to implement form validation. Install Flask-WTF To use Flask-WTF, you first need to install it. You can use the pip command to install: pipinstallFlask-WTF import the required modules in F

Laravel is a popular PHP web development framework that provides many convenient features to speed up the work of developers. Among them, LaravelValidation is a very practical function that can help us easily validate form requests and user-entered data. This article will introduce how to use LaravelValidation to validate form requests. What is LaravelValidationLaravelValidation is La

Form validation is a very important link in web application development. It can check the validity of the data before submitting the form data to avoid security vulnerabilities and data errors in the application. Form validation for web applications can be easily implemented using Golang. This article will introduce how to use Golang to implement form validation for web applications. 1. Basic elements of form validation Before introducing how to implement form validation, we need to know what the basic elements of form validation are. Form elements: form elements are

How to use middleware to handle form validation in Laravel, specific code examples are required Introduction: Form validation is a very common task in Laravel. In order to ensure the validity and security of the data entered by users, we usually verify the data submitted in the form. Laravel provides a convenient form validation function and also supports the use of middleware to handle form validation. This article will introduce in detail how to use middleware to handle form validation in Laravel and provide specific code examples.

PHP form validation tips: How to use the filter_input function to verify user input Introduction: When developing web applications, forms are an important tool for interacting with users. Correctly validating user input is one of the key steps to ensure data integrity and security. PHP provides the filter_input function, which can easily verify and filter user input. This article will introduce how to use the filter_input function to verify user input and provide relevant code examples. one,

PHP is a scripting language widely used in web development, and its form validation and filtering are very important parts. When the user submits the form, the data entered by the user needs to be verified and filtered to ensure the security and validity of the data. This article will introduce methods and techniques on how to perform form validation and filtering in PHP. 1. Form validation Form validation refers to checking the data entered by the user to ensure that the data complies with specific rules and requirements. Common form verification includes verification of required fields, email format, and mobile phone number format.

How to use the Hyperf framework for form validation Introduction: With the development of web applications, form validation has become an important part of ensuring the accuracy and security of data. As a high-performance PHP development framework, the Hyperf framework provides powerful form validation functions. This article will introduce how to use the Hyperf framework for form validation and provide specific code examples. 1. Install the Hyperf framework: Use Composer to install: composercreate-proje
