很多新手都不知道asp用户注册和,用户注册代码以及asp用户注册系统 是怎么写了好了我们今天就来写写,asp用户注册源代码吧.
Sub UserReguser()
Dim nickname,UserPass,UserEmail,Question,Answer,usercookies
Dim strGroupName,Password,usersex,sex
Dim Rs,SQL
UserPass = Newasp.checkstr(XmlDoc.documentElement.selectSingleNode("password").text)
UserEmail = Newasp.checkstr(Trim(XmlDoc.documentElement.selectSingleNode("email").text))
Question = Newasp.checkstr(XmlDoc.documentElement.selectSingleNode("question").text)
Answer = Newasp.checkstr(XmlDoc.documentElement.selectSingleNode("answer").text)
sex = Newasp.ChkNumeric(XmlDoc.documentElement.selectSingleNode("gender").text)
If sex = 0 Then
usersex = "女"
Else
usersex = "男"
End If
usercookies = 1
If UserName = "" Or UserPass = "" Then
Status = 1
Messenge = Messenge & "<li>请填写用户名或密码。"
Exit Sub
End If
If Question = "" Then Question = Newasp.GetRandomCode
If Answer = "" Then Answer = Newasp.GetRandomCode
nickname = UserName
Password = md5(UserPass)
Answer = md5(Answer)
If Newasp.IsValidStr(UserName) = False Then
Messenge = Messenge & "<li>登录账号中含有非法字符!</li>"
Status = 1
Exit Sub
End If
If IsValidEmail(UserEmail) = False Then
Messenge = Messenge & "<li>您的Email有错误!</li>"
Status = 1
Exit Sub
End If
Set Rs = Newasp.Execute("SELECT username FROM NC_User WHERE username='" & UserName & "'")
If Not (Rs.BOF And Rs.EOF) Then
Status = 1
Messenge = Messenge & "<li>Sorry!此用户已经存在,请换一个用户名再试!</li>"
Exit Sub
End If
Rs.Close:Set Rs = Nothing
Set Rs = Newasp.Execute("SELECT username FROM NC_Admin WHERE username='" & UserName & "'")
If Not (Rs.BOF And Rs.EOF) Then
Status = 1
Messenge = Messenge & "<li>Sorry!此用户已经存在,请换一个用户名再试!</li>"
Exit Sub
End If
Rs.Close:Set Rs = Nothing
If CInt(Newasp.ChkSameMail) = 1 Then
Set Rs = Newasp.Execute("SELECT userid FROM NC_User WHERE usermail='" & UserEmail & "'")
If Not Rs.EOF Then
Status = 1
Messenge = Messenge & "<li>对不起!本系统已经限制一个邮箱只能注册一个账号。</li><li>此邮箱["&UserEmail&"]已经占用,请您换一个邮箱再注册吧。</li>"
Exit Sub
End If
Rs.Close:Set Rs = Nothing
End If
'---
Set Rs = Newasp.Execute("SELECT GroupName FROM NC_UserGroup WHERE Groupid=3")
If Rs.BOF And Rs.EOF Then
strGroupName = "普通会员"
Else
strGroupName = Newasp.CheckBadstr(Rs(0))
If Len(strGroupName) = 0 Then strGroupName = "普通会员"
End If
Rs.Close:Set Rs = Nothing
Set Rs = Server.CreateObject("ADODB.Recordset")
SQL = "SELECT * FROM NC_User WHERE (userid is null)"
Rs.Open SQL,Conn,1,3
Rs.Addnew
Rs("username") = UserName
Rs("password") = Password
Rs("nickname") = UserName
Rs("UserGrade") = 1
Rs("UserGroup") = strGroupName
Rs("UserClass") = 0
If CInt(Newasp.AdminCheckReg) = 1 Then
Rs("UserLock") = 1
Else
Rs("UserLock") = 0
End If
Rs("UserFace") = "face/1.gif"
Rs("userpoint") = CLng(Newasp.AddUserPoint)
Rs("usermoney") = 0
Rs("savemoney") = 0
Rs("prepaid") = 0
Rs("experience") = 10
Rs("charm") = 10
Rs("TrueName") = UserName
Rs("usersex") = usersex
Rs("usermail") = UserEmail
Rs("oicq") = ""
Rs("question") = Question
Rs("answer") = Answer
Rs("JoinTime") = Now()
Rs("ExpireTime") = Now()
Rs("LastTime") = Now()
Rs("Protect") = 0
Rs("usermsg") = 0
Rs("userlastip") = Newasp.GetUserip
Rs("userlogin") = 0
Rs("usersetting") = ",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,"
Rs.update
Rs.Close
Set Rs = Nothing
Status = 0
Messenge = "用户注册成功。"
End Sub