ASP User Registration Program

Source: Internet
Author: User
Tags md5

Many beginners do not know the ASP user registration and, user registration code and the ASP user registration system is how to write a good we will write today, the ASP user registration source code bar.

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 = "female"
Else
Usersex = "Male"
End If
Usercookies = 1
If UserName = "" Or userpass = "" Then
Status = 1
Messenge = messenge & <li> Please fill in the username or password. "
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> login account contains illegal characters!" </li> "
Status = 1
Exit Sub
End If
If IsValidEmail (useremail) = False Then
Messenge = messenge & "<li> your email is wrong!" </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! This user already exists, please try again by changing a username! </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! This user already exists, please try again by changing a username! </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> Sorry! The system has limited a mailbox can only register an account. </li><li> this mailbox ["&UserEmail&"] has been occupied, please change a mailbox and then register it. </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 = "Ordinary Member"
Else
Strgroupname = newasp.checkbadstr (Rs (0))
If Len (strgroupname) = 0 Then Strgroupname = "Ordinary Member"
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 = "User registration succeeded. "
End Sub

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.