标题:求助:ASP检查用户名是否已被注册时出错SQL2000数据
取消只看楼主
sbjeso
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2013-9-22
结帖率:0
已结贴  问题点数:20 回复次数:2 
求助:ASP检查用户名是否已被注册时出错SQL2000数据

用户名字无论填写什么都提示: 用户名已经存在

<%
If useroff=0 then Call Alert("网站目前已经关闭会员功能","../")
Dim UserName
UserName = LoseHtml(trim(request.form("UserName")))
set rs = server.CreateObject ("adodb.recordset")
sql="select * From ["&tbname&"_User] where username='"&UserName&"'"
rs.open sql,conn,1,3
if not rs.eof and not rs.bof then
rs.close
set rs=nothing
Call Alert ("错误:对不起,该用户已存在,请选择新的用户名!","-1")
elseif Not ChkRegName(UserName) then
Call Alert ("注册失败,你想要注册的用户中含有本站禁止注册的字符!","-1")
else
dim sql,rs

UserName =         LoseHtml(trim(request.form("UserName")))
PassWord =         trim(request.form("UserPassWord"))
Sex =             trim(request.form("UserSex"))
Email =         trim(request.form("UserEmail"))
QQ =             trim(request.form("UserQQ"))
TrueName =         trim(request.form("TrueName"))
myyear=            LaoYRequest(request("year"))
mymonth=        LaoYRequest(request("month"))
myday=            LaoYRequest(request("day"))
Birthday =         myyear&"-"&mymonth&"-"&myday
Province =         request.form("Province")
City =             request.form("City")

        if UserName="" then
            Call Alert ("请填写用户名!","-1")
        elseif len(UserName)<2 then
            Call Alert ("用户名不得少于2个字!","-1")
        elseif PassWord="" then
            Call Alert ("请填写密码!","-1")
        elseif myyear="" or mymonth="" or myday="" then
            Call Alert ("请选择出生日期!","-1")
        elseif Province="" or City="" then
            Call Alert ("请选择籍贯!","-1")
        elseif Email="" then
            Call Alert ("请填写Email!","-1")
        elseif QQ="" then
            Call Alert ("请填写QQ!","-1")
        end if
        If Not Checkpost(True) Then Call Alert("禁止外部提交!","-1")
        rs.AddNew
        rs("UserName")            =UserName
        rs("PassWord")            =md5(PassWord,16)
        rs("Sex")                =Sex
        rs("Email")                =Email
        rs("UserQQ")            =QQ
        rs("TrueName")            =TrueName
        rs("Birthday")            =Birthday
        rs("Province")            =Province
        rs("City")                =City
        rs("RegTime")            =Now()
        rs("LastTime")            =Now()
        rs("IP")                =GetIP
        rs("LastIP")            =GetIP
        rs("UserMoney")            =0
        rs("usergroupid")        =3
        rs("yn")                =userynoff
        
        set rs4 = server.CreateObject ("adodb.recordset")
        sql="select top 1 * from "&tbname&"_UserGroup Where usermoney <> -1 order by Usermoney asc"
        rs4.open sql,conn,1,1
        dengji=rs4("GroupName")
        dengjipic=rs4("GroupPic")
        rs4.close
        set rs4=nothing   
   
        rs("dengji")            =dengji
        rs("dengjipic")            =dengjipic
        rs.update
        If userynoff=1 then
        Response.Cookies("Yao").path=SitePath
        Response.Cookies("Yao")("UserName")=username
        Response.Cookies("Yao")("UserPass")=md5(PassWord,16)
        Response.Cookies("Yao")("ID")=rs("ID")
        Call Alert ("恭喜你,注册成功","UserAdd.asp?action=useredit")
        Else
        Call Alert ("恭喜你,注册成功,请等待管理员审核!","../")
        End if
    rs.close
    Set rs=nothing
End if
%>

[ 本帖最后由 sbjeso 于 2013-9-22 15:56 编辑 ]
搜索更多相关主题的帖子: 用户名 where 会员 网站 
2013-09-22 12:37
sbjeso
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2013-9-22
得分:0 
<!--#include file="../Inc/conn.asp"-->
<!--#include file="../Inc.asp"-->
<!--#include file="../Inc/md5.asp"-->
<%
If useroff=0 then Call Alert("网站目前已经关闭会员功能","../")
Dim UserName
UserName = LoseHtml(trim(request.form("UserName")))
set rs = server.CreateObject ("adodb.recordset")
sql="select * From ["&tbname&"_User] where username='"&UserName&"'"
rs.open sql,conn,1,3
if not rs.eof and not rs.bof then
rs.close
set rs=nothing
Call Alert ("错误:对不起,该用户已存在,请选择新的用户名!","-1")
elseif Not ChkRegName(UserName) then
Call Alert ("注册失败,你想要注册的用户中含有本站禁止注册的字符!","-1")
else
dim sql,rs

UserName =         LoseHtml(trim(request.form("UserName")))
PassWord =         trim(request.form("UserPassWord"))
Sex =             trim(request.form("UserSex"))
Email =         trim(request.form("UserEmail"))
QQ =             trim(request.form("UserQQ"))
TrueName =         trim(request.form("TrueName"))
myyear=            LaoYRequest(request("year"))
mymonth=        LaoYRequest(request("month"))
myday=            LaoYRequest(request("day"))
Birthday =         myyear&"-"&mymonth&"-"&myday
Province =         request.form("Province")
City =             request.form("City")

        if UserName="" then
            Call Alert ("请填写用户名!","-1")
        elseif len(UserName)<2 then
            Call Alert ("用户名不得少于2个字!","-1")
        elseif PassWord="" then
            Call Alert ("请填写密码!","-1")
        elseif myyear="" or mymonth="" or myday="" then
            Call Alert ("请选择出生日期!","-1")
        elseif Province="" or City="" then
            Call Alert ("请选择籍贯!","-1")
        elseif Email="" then
            Call Alert ("请填写Email!","-1")
        elseif QQ="" then
            Call Alert ("请填写QQ!","-1")
        end if
        If Not Checkpost(True) Then Call Alert("禁止外部提交!","-1")
        rs.AddNew
        rs("UserName")            =UserName
        rs("PassWord")            =md5(PassWord,16)
        rs("Sex")                =Sex
        rs("Email")                =Email
        rs("UserQQ")            =QQ
        rs("TrueName")            =TrueName
        rs("Birthday")            =Birthday
        rs("Province")            =Province
        rs("City")                =City
        rs("RegTime")            =Now()
        rs("LastTime")            =Now()
        rs("IP")                =GetIP
        rs("LastIP")            =GetIP
        rs("UserMoney")            =0
        rs("usergroupid")        =3
        rs("yn")                =userynoff
        
        set rs4 = server.CreateObject ("adodb.recordset")
        sql="select top 1 * from "&tbname&"_UserGroup Where usermoney <> -1 order by Usermoney asc"
        rs4.open sql,conn,1,1
        dengji=rs4("GroupName")
        dengjipic=rs4("GroupPic")
        rs4.close
        set rs4=nothing   
   
        rs("dengji")            =dengji
        rs("dengjipic")            =dengjipic
        rs.update
        If userynoff=1 then
        Response.Cookies("Yao").path=SitePath
        Response.Cookies("Yao")("UserName")=username
        Response.Cookies("Yao")("UserPass")=md5(PassWord,16)
        Response.Cookies("Yao")("ID")=rs("ID")
        Call Alert ("恭喜你,注册成功","UserAdd.asp?action=useredit")
        Else
        Call Alert ("恭喜你,注册成功,请等待管理员审核!","../")
        End if
    rs.close
    Set rs=nothing
End if
%>
2013-09-22 14:45
sbjeso
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2013-9-22
得分:0 
回复 2楼 dzt0001
<!--#include file="../Inc/conn.asp"-->
<!--#include file="../Inc.asp"-->
<!--#include file="../Inc/md5.asp"-->
<%
If useroff=0 then Call Alert("网站目前已经关闭会员功能","../")
Dim UserName
UserName = LoseHtml(trim(request.form("UserName")))
set rs = server.CreateObject ("adodb.recordset")
sql="select * From ["&tbname&"_User] where username='"&UserName&"'"
rs.open sql,conn,1,3
if not rs.eof and not rs.bof then
rs.close
set rs=nothing
Call Alert ("错误:对不起,该用户已存在,请选择新的用户名!","-1")
elseif Not ChkRegName(UserName) then
Call Alert ("注册失败,你想要注册的用户中含有本站禁止注册的字符!","-1")
else
dim sql,rs

UserName =         LoseHtml(trim(request.form("UserName")))
PassWord =         trim(request.form("UserPassWord"))
Sex =             trim(request.form("UserSex"))
Email =         trim(request.form("UserEmail"))
QQ =             trim(request.form("UserQQ"))
TrueName =         trim(request.form("TrueName"))
myyear=            LaoYRequest(request("year"))
mymonth=        LaoYRequest(request("month"))
myday=            LaoYRequest(request("day"))
Birthday =         myyear&"-"&mymonth&"-"&myday
Province =         request.form("Province")
City =             request.form("City")

        if UserName="" then
            Call Alert ("请填写用户名!","-1")
        elseif len(UserName)<2 then
            Call Alert ("用户名不得少于2个字!","-1")
        elseif PassWord="" then
            Call Alert ("请填写密码!","-1")
        elseif myyear="" or mymonth="" or myday="" then
            Call Alert ("请选择出生日期!","-1")
        elseif Province="" or City="" then
            Call Alert ("请选择籍贯!","-1")
        elseif Email="" then
            Call Alert ("请填写Email!","-1")
        elseif QQ="" then
            Call Alert ("请填写QQ!","-1")
        end if
        If Not Checkpost(True) Then Call Alert("禁止外部提交!","-1")
        rs.AddNew
        rs("UserName")            =UserName
        rs("PassWord")            =md5(PassWord,16)
        rs("Sex")                =Sex
        rs("Email")                =Email
        rs("UserQQ")            =QQ
        rs("TrueName")            =TrueName
        rs("Birthday")            =Birthday
        rs("Province")            =Province
        rs("City")                =City
        rs("RegTime")            =Now()
        rs("LastTime")            =Now()
        rs("IP")                =GetIP
        rs("LastIP")            =GetIP
        rs("UserMoney")            =0
        rs("usergroupid")        =3
        rs("yn")                =userynoff
        
        set rs4 = server.CreateObject ("adodb.recordset")
        sql="select top 1 * from "&tbname&"_UserGroup Where usermoney <> -1 order by Usermoney asc"
        rs4.open sql,conn,1,1
        dengji=rs4("GroupName")
        dengjipic=rs4("GroupPic")
        rs4.close
        set rs4=nothing   
   
        rs("dengji")            =dengji
        rs("dengjipic")            =dengjipic
        rs.update
        If userynoff=1 then
        Response.Cookies("Yao").path=SitePath
        Response.Cookies("Yao")("UserName")=username
        Response.Cookies("Yao")("UserPass")=md5(PassWord,16)
        Response.Cookies("Yao")("ID")=rs("ID")
        Call Alert ("恭喜你,注册成功","UserAdd.asp?action=useredit")
        Else
        Call Alert ("恭喜你,注册成功,请等待管理员审核!","../")
        End if
    rs.close
    Set rs=nothing
End if
%>
2013-09-22 14:54



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-420894-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.898026 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved