DISCUZ 2.0 Integrated ASP system, user Add function _ Application technique

Source: Internet
Author: User
Functions can refer to:
Copy Code code as follows:

' Register forum user, parameter description
' Username User login name
' Password user has login password
' GroupID user group ID, senior member, user group ID 17; Full member, user group ID 18; Ordinary member, then user group ID is 10
' Email,realname,mobile,phone email, real name, cell phone, phone
Sub Regbbsuser (Username,password,groupid,email,realname,mobile,phone)
' Database connection
mm_conn_bbs_string= "Driver={sql Server};server=surui;uid=sa;pwd=sa;database=ntylswbbs;"
Set connbbs=server.createobject ("ADODB. Connection ")
Connbbs.open mm_conn_bbs_string
' Check to see if the user name exists
Checkuser= "SELECT * from dnt_users where username= '" &username ""
Set Checkuserrs=connbbs.execute (CheckUser)
If not checkuserrs.eof then
Haveuser= "true"
Haveuser= "false"
End If
' If the user does not exist, increase the forum user
If haveuser= "false" then

' Update dnt_users (user information) table
Sql1= "SELECT * from Dnt_users"
Set Rs1=server.createobject ("ADODB. Recordset ")
Rs1.open sql1,connbbs,1,3
Rs1 ("username") =username
Rs1 ("password") =md532 (password)
Rs1 ("GroupID") =groupid
Rs1 ("email") =email

' Read the ID of the newly created user
Sql2= "SELECT * from dnt_users where username= '" &username ""
Set Rs2=server.createobject ("ADODB. Recordset ")
Rs2.open sql2,connbbs,1,1
Useruid=rs2 ("UID")

' Update dnt_userfields (user related information) table
Sql3= "SELECT * from Dnt_userfields"
Set Rs3=server.createobject ("ADODB. Recordset ")
Rs3.open sql3,connbbs,1,3
RS3 ("UID") =useruid
If realname<> "" Then
RS3 ("Realname") =realname
End If
If mobile<> "" Then
RS3 ("mobile") =mobile
End If
If phone<> "" Then
RS3 ("Phone") =phone
End If

' Update dnt_statistics (Forum status information) table
Sql4= "SELECT * from Dnt_statistics"
Set Rs4=server.createobject ("ADODB. Recordset ")
Rs4.open sql4,connbbs,1,3
RS4 ("Totalusers") =rs4 ("Totalusers") +1
RS4 ("Lastusername") =username
RS4 ("Lastuserid") =useruid

End If


End Sub

' Call function
Call Regbbsuser ("ASP", "123456789", "123@163.com", "La la la", "13580351626", "0207235803")
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.