discuz 2.0整合asp系統(tǒng),用戶添加函數(shù)
更新時間:2009年06月24日 23:49:38 作者:
我的做法是,用戶在原來的登錄系統(tǒng)登錄一次,記錄用戶名和密碼明碼,然后往數(shù)據(jù)庫里面添加一個論壇用戶(注意密碼用32位的MD5),然后再用雪人的方法整合同步登錄就可以了
函數(shù)可以參考:
<%
'注冊論壇用戶,參數(shù)說明
'username 用戶登錄名稱
'password 用戶有登錄密碼
'groupid 用戶組id,高級會員,用戶組id為17;正式會員,用戶組id為18;普通會員,則用戶組id為10
'email,realname,mobile,phone 電子郵件,真實姓名,手機,電話
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")
%>
復制代碼 代碼如下:
<%
'注冊論壇用戶,參數(shù)說明
'username 用戶登錄名稱
'password 用戶有登錄密碼
'groupid 用戶組id,高級會員,用戶組id為17;正式會員,用戶組id為18;普通會員,則用戶組id為10
'email,realname,mobile,phone 電子郵件,真實姓名,手機,電話
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下利用fso實現(xiàn)文件夾或文件移動改名等操作函數(shù)
以后利用fso來操作文件和文件夾就方便了2008-01-01ASP獲取ACCESS數(shù)據(jù)庫表名及結(jié)構(gòu)的代碼
此方法可獲得ACCESS數(shù)據(jù)的表名及其結(jié)構(gòu),數(shù)據(jù)類型等... 程序過濾了幾個ACCESS數(shù)據(jù)庫的幾個隱藏表(可能是導致ACCESS數(shù)據(jù)庫刪除數(shù)據(jù)還會變大的原因)2008-08-08Asp中Server.ScriptTimeOut屬性需要注意的一點分析
Server.ScriptTimeout 這個屬性給定Asp腳本執(zhí)行的最大時間,如果asp程序的運行時間超過了這個屬性規(guī)定的值,Asp就會報錯。2011-06-06asp動態(tài)include文件,方便多模板的實現(xiàn)
asp動態(tài)include文件,方便多模板的實現(xiàn)...2007-08-08通過表單的做為二進制文件上傳request.totalbytes提取出上傳的二級制數(shù)據(jù)
通過表單的做為二進制文件上傳request.totalbytes提取出上傳的二級制數(shù)據(jù)的代碼說明。2009-09-09ImageMagickObject獲取圖片的信息無返回值的解決辦法
這篇文章主要介紹了ImageMagickObject獲取圖片的信息無返回值的解決辦法,非常簡單,加上format參數(shù)即可,需要的朋友可以參考下2015-05-05