请教:整合动网论坛的会员判断程序
网站上的会员注册,登陆,注销要和动网论坛共享(但网站上的会员信息可以在论坛通用,但论坛上的不一定有权限在网站上通用)
写了四个接口函数,以供网站调用和判断.其中第三个和第四个函数有些问题,高手帮忙看一下,谢谢!(如果前两个有问题,也麻烦指出来)
<!--#includer file="conn.asp"-->
<!--#include file="inc/md5.asp"-->
<!--#include file="inc/const.asp"-->
<%
'**********************************函数(1):检查用户名是否重复
'功能说明:检查用户名是否重复,功能:当用户名重复返回1,当数据库里无此用户名返回0
'传入参数为:用户名
Function Checkexist(username)
dim rs1,sqltext
set rs1=server.createobject("adodb.recordset")
sqltext="select * from DV_admin where username='"&username&"'"
rs1.open sqltext,conn,1,1
if rs1.EOF and rs1.BOF then
Checkexist=1
else
Checkexist=0
end if
rs1.close
set rs1=nothing
end function
%>
<%
'*********************函数(2):会员注册函数
Function Register(username,userpassword,userquesion,useranswer,useremail)
'会员注册函数说明:通过该函数,如果无此用户名,则重新在数据库生成该新用户,如果有此用户名,则用最新参数覆盖原来的属性,
'传入参数为:为:用户名、密码、密码找回问题、密码找回答复、电子邮件
dim rs2,sqltext
set rs2=server.createobject("adodb.recordset")
sqltext="select * from DV_user where username='"&username&"'"
rs2.open sqltext,conn,1,3
'如果没有此用户名,那么存入数据库中
if rs2.EOF and rs2.BOF then
rs2.addnew
rs2("username")=username
rs2("userpassword")=userpassword
rs2("UserQuesion")=UserQuesion
rs2("useranswer")=useranswer
rs2("useremail")=useremail
rs2.update
response.write"注册成功!请牢记您的用户名和密码。"
response.end
else
'否则覆盖掉原来的
rs2("username")=username
rs2("userpassword")=userpassword
rs2("UserQuesion")=UserQuesion
rs2("useranswer")=useranswer
rs2("useremail")=useremail
rs2.update
rs2.close
set rs2=nothing
end if
end function
%>
<%
'**********************************登陆确认函数(3)
'登陆确认函数,当用户名和密码和数据库系统里校验准确,则对论坛做登陆状态设置,否则返回0
'传入参数为:用户名、密码;
Function logincheck(username,userpassword)
dim rs3,sqltext
set rs3=server.createobject("adodb.recordset")
sqltext="select * from DV_User where username='"&username&"' and userpassword='"&userpassword&"'"
rs3.open sqltext,conn,1,1
if not rs3.EOF or rs3.BOF then
response.write"登陆成功!"
else
Logincheck=0
response.write"登陆失败!"
rs3.close
set rs3=nothing
end if
end function
%>
<%
'*********************************注销函数(4)
'注销退出函数,当校验正确,则将论坛置成用户退出状态!
'传入参数为:用户名,密码
Function Logout(username,userpassword)
userpassword=md5(userpassword,16)
dim rs4,sqltext
set rs4=server.createobject("adodb.recordset")
sqltext="select * from DV_User where username='"&username&"' and userpassword='"&userpassword&"'"
rs4.open sqltext,conn,1,1
if not rs4.EOF or rs4.BOF then
Response.Cookies(Dvbbs.Forum_sn)("username")=""
Response.Cookies(Dvbbs.Forum_sn)("password")=""
Session("flag")=Empty
rs4.close
set rs4=nothing
end if
end function
%>