| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 700 人关注过本帖
标题:求助:ASP检查用户名是否已被注册时出错SQL2000数据
只看楼主 加入收藏
sbjeso
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2013-9-22
结帖率:0
收藏
已结贴  问题点数:20 回复次数:4 
求助: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
dzt0001
Rank: 13Rank: 13Rank: 13Rank: 13
等 级:蒙面侠
威 望:5
帖 子:1281
专家分:4998
注 册:2005-10-12
收藏
得分:10 
请给出相关代码

----我怎能在别人的苦难面前转过脸去----
2013-09-22 14:21
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
303770957
Rank: 11Rank: 11Rank: 11Rank: 11
等 级:小飞侠
威 望:6
帖 子:838
专家分:2125
注 册:2005-9-10
收藏
得分:10 
请问你 rs.open sql,conn,1,3 这一句中的conn对象在哪里呢?连接对象都没有创建呢,你就打开数据库,这不大可能吧?

♂ 死后定当长眠,生前何须久睡。♀
2013-09-22 17:28
快速回复:求助:ASP检查用户名是否已被注册时出错SQL2000数据
数据加载中...
 
   



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

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