For functions, refer:
Copy codeThe Code is as follows: <%
'Register a forum user. parameter descriptions
'Username User Logon Name
'Password: the user has a logon password.
'Groupid user group id, senior member, user group id 17; formal member, user group id 18; common member, user group id 10
'Email, realname, mobile, phone, real name, mobile phone number
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 whether the user name exists
Checkuser = "select * from dnt_users where username = '" & username "'"
Set checkuserrs1_connbbs.exe cute (checkuser)
If not checkuserrs. eof then
Haveuser = "true"
Else
Haveuser = "false"
End if
'If the user does not exist, add a 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.addnew
Rs1 ("username") = username
Rs1 ("password") = md532 (password)
Rs1 ("groupid") = groupid
Rs1 ("email") = email
Rs1.update
Rs1.close
'Read the id of the 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 ")
Rs2.close
'Update the dnt_userfields table
Sql3 = "select * from dnt_userfields"
Set rs3 = server. createobject ("ADODB. Recordset ")
Rs3.open sql3, connbbs, 1, 3
Rs3.addnew
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
Rs3.update
Rs3.close
'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
Rs4.update
Rs4.close
End if
Connbbs. close
End sub
'Call a function
Call regbbsuser ("asp", "123456789", 18, "123@163.com", "La la", "13580351626", "0207235803 ")
%>