hw_oldcash(i)=rs(\ hw_content(i)=rs(\ hw_pic(i)=rs(\ hw_date(i)=rs(\ rs.movenext loop end if rs.close %> (二)用户注册
当用户填写了注册资料后,通过REGSAVE.ASP来验证,当验证不通过时(如有的资料没填写等),输出出错提醒,当验证通过时输出通过消息,并将资料写入数据库中的USER表里。
(1) 资料验证的代码实现 <%
function IsValidEmail(user_mail) dim names, name, i, c
'Check for valid syntax in an email address. IsValidEmail = true
names = Split(user_mail, \
if UBound(names) <> 1 then IsValidEmail = false exit function end if
for each name in names if Len(name) <= 0 then IsValidEmail = false exit function end if
for i = 1 to Len(name) c = Lcase(Mid(name, i, 1))
if InStr(\c) <= 0 and not IsNumeric(c) then
IsValidEmail = false exit function end if next
if Left(name, 1) = \ IsValidEmail = false exit function
end if next
if InStr(names(1), \ IsValidEmail = false exit function end if
i = Len(names(1)) - InStrRev(names(1), \if i <> 2 and i <> 3 then IsValidEmail = false exit function end if
if InStr(email, \ IsValidEmail = false end if end function dim
user_name,user_pass,user_pass2,user_mail,user_adds,user_tel,uesr_postcode if trim(request(\
errmsg=errmsg+\用户名不能为空\ founderr=true
else
user_name=trim(request(\end if
if trim(request(\ errmsg=errmsg+\密码或确认不能为空\ founderr=true else
user_pass=trim(request(\ user_pass2=trim(request(\end if
if user_pass <> user_pass2 then
errmsg=errmsg+\两次密码不同\ founder=true end if
if request(\
errmsg=errmsg+\地址不能为空\ founderr=true else
user_adds=request(\end if
相关推荐: