My approach is to log in once to the original login system, record the username and password, then add a forum user to the database (note that the password is 32-bit MD5), and then use Snowman's method to integrate and synchronize the login. Functions can be referenced:
Copy the code code as follows:
<%
'Register forum user, parameter description
'username user login name
'password user has a login password
'groupid User group id, for senior members, the user group id is 17; for formal members, the user group id is 18; for ordinary members, the user group id is 10
'email,realname,mobile,phone email,realname,mobile,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 if the username exists
checkuser=select * from dnt_users where username='&username'
set checkuserrs=connbbs.execute(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 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)
rs2.close
'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.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 function
call regbbsuser(asp,123456789,18,[email protected],la la la,13580351626,0207235803)
%>