asp如何验证用户名已存在?验证两次输入的密码不一致?[给您加100分]
下面是我做的一张简单的asp注册验证页面,zcok.asp.运行一切正常,但由于本人是菜菜鸟,不知在此页面上如何验证用户名(name)是否存在?两次输入的密码是否一致?(两个密码字段是:pwd1,pwd2)我想求助的是-----------------就在此页面上(zcok.asp)如何写-----------------①用户名已存在?-----------②两次输入的密码是否一致?
我是怀着极大的希望来到这里的,我真的是菜菜鸟,就请您帮帮我吧!而且就在此页面上写,好吗?不胜感激!我会为您加高分的!!!
zcok.asp---------------注册验证页面,代码如下:
<%
'//从提交页获取表单内容//
dim name,sex,title,email,verifycode,pwd
name=replace(trim(request.form("name")),"'","")
sex=request.form("sex")
email=replace(trim(request.form("email")),"'","")
verifycode=request.form("verifycode")
pwd1=replace(trim(request.form("pwd1")),"'","")
if name="" or len(name)>12 then
response.write "<SCRIPT language=JavaScript>alert('昵称不能为空or超长!');"
response.write "this.location.href='vbscript:history.back()';</SCRIPT>"
response.end
elseif email="" Then
response.write "<SCRIPT language=JavaScript>alert('请填写正确的邮箱地址!');"
response.write "this.location.href='vbscript:history.back()';</SCRIPT>"
response.end
elseif verifycode="" or cstr(verifycode)<>cstr(Session("getcode")) then
response.write "<SCRIPT language=JavaScript>alert('验证码错误!');"
response.write "this.location.href='vbscript:history.back()';</SCRIPT>"
response.end
elseif pwd1="" or len(pwd1)>26 then
response.write "<SCRIPT language=JavaScript>alert('密码不能为空or超长!');"
response.write "this.location.href='vbscript:history.back()';</SCRIPT>"
response.end
else
%>
<!--#include file="inc/conn.asp"-->
<%
dim sqlin
sqlin="insert into ad2 (name,sex,email,pwd1) values ('"+(name)+"','"+(sex)+"','"+(email)+"','"+(pwd1)+"')"
conn.execute(sqlin)
conn.close
set conn=nothing
response.redirect "cg2.asp"
end if
%>