discuz 2.0整合asp系統(tǒng),用戶添加函數(shù)
更新時(shí)間:2009年06月24日 23:49:38 作者:
我的做法是,用戶在原來的登錄系統(tǒng)登錄一次,記錄用戶名和密碼明碼,然后往數(shù)據(jù)庫里面添加一個(gè)論壇用戶(注意密碼用32位的MD5),然后再用雪人的方法整合同步登錄就可以了
函數(shù)可以參考:
<%
'注冊論壇用戶,參數(shù)說明
'username 用戶登錄名稱
'password 用戶有登錄密碼
'groupid 用戶組id,高級會(huì)員,用戶組id為17;正式會(huì)員,用戶組id為18;普通會(huì)員,則用戶組id為10
'email,realname,mobile,phone 電子郵件,真實(shí)姓名,手機(jī),電話
sub regbbsuser(username,password,groupid,email,realname,mobile,phone)
'數(shù)據(jù)庫連接
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
'檢查用戶名是否存在
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 haveuser="false" then
'更新dnt_users(用戶信息)表
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
'讀取剛建立用戶的id
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
'更新dnt_userfields(用戶相關(guān)信息)表
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
'更新dnt_statistics(論壇狀態(tài)信息)表
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
'調(diào)用函數(shù)
call regbbsuser("asp","123456789",18,"123@163.com","啦啦啦","13580351626","0207235803")
%>
復(fù)制代碼 代碼如下:
<%
'注冊論壇用戶,參數(shù)說明
'username 用戶登錄名稱
'password 用戶有登錄密碼
'groupid 用戶組id,高級會(huì)員,用戶組id為17;正式會(huì)員,用戶組id為18;普通會(huì)員,則用戶組id為10
'email,realname,mobile,phone 電子郵件,真實(shí)姓名,手機(jī),電話
sub regbbsuser(username,password,groupid,email,realname,mobile,phone)
'數(shù)據(jù)庫連接
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
'檢查用戶名是否存在
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 haveuser="false" then
'更新dnt_users(用戶信息)表
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
'讀取剛建立用戶的id
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
'更新dnt_userfields(用戶相關(guān)信息)表
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
'更新dnt_statistics(論壇狀態(tài)信息)表
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
'調(diào)用函數(shù)
call regbbsuser("asp","123456789",18,"123@163.com","啦啦啦","13580351626","0207235803")
%>
相關(guān)文章
ASP正則表達(dá)式清除HTML指定標(biāo)簽的方法
這篇文章主要介紹了ASP正則表達(dá)式清除HTML指定標(biāo)簽的方法,告訴大家如何精準(zhǔn)的過濾掉某些特定的屬性標(biāo)簽和參數(shù),感興趣的小伙伴們可以參考一下2015-09-09
asp OpenTextFile文本讀取與寫入實(shí)例代碼
打開指定的文件并返回一個(gè) TextStream 對象,可以讀取、寫入此對象或?qū)⑵渥芳拥轿募?2008-08-08
ASP中SELECT下拉菜單同時(shí)獲取VALUE和TEXT值的實(shí)現(xiàn)代碼
這篇文章主要介紹了ASP中SELECT下拉菜單同時(shí)獲取VALUE和TEXT值的實(shí)現(xiàn)代碼,需要的朋友可以參考下2020-06-06
ASP 關(guān)于動(dòng)態(tài)數(shù)據(jù)顯示頁面得錨點(diǎn)
ASP 關(guān)于動(dòng)態(tài)數(shù)據(jù)顯示頁面得錨點(diǎn)...2007-09-09

