asp程序里如何限制英文或数字或英文数字组合注册ID? 如下代码中如何添加需要限制的字符?谢谢!!

来源:百度知道 编辑:UC知道 时间:2024/06/16 22:58:32
asp程序里如何限制英文或数字或英文数字组合注册ID? 如下代码中如何添加需要限制的字符?谢谢!!

my()
response.end
end if
if InStr(s.txt("huiyuan"),".")<>0 or InStr(s.txt("huiyuan"),",") or InStr(trim(request("huiyuan"))," ")<>0 then
width="500"
my_bt="系统提示错误"
my_nr="<meta http-equiv=refresh content=4;url=javascript:history.go(-1)><b>对不起!你不能成功地注册!</b></font><br>·您申请的会员账号 <font color=red>"&s.txt("huiyuan")&"</font> 含有限制注册字符或空格不允许注册。<br>·请重新选择一个会员账号。"

以上代码是程序注册页里的,reg.asp

把ID里的字符一个个替换掉,最后如果长度大于0就表示含有非法字符...笨办法,会的话可以用正则表达式

function chkstr(strx)
str = "1,2,3,4,5,6,7,8,9,0,a,b......"
arr = split(str,",")

for i = 0 to ubound(arr)
strx = replace(strx,arr(i),"")
next

if len(strx) > 0 then
chkstr = false
else
chkstr = true
end if

end function