【www.gdgbn.com--php函数】
asp教程用户登录,退出登录函数
login.asp
<%
on error resume next
set conn=server.createobject("adodb.connection")
conn.open connstr
if err then
response.write ""&issqlver&"数据库教程连接出错,请检查连接字串。
"&err.source&" ("&err.number&")"
set conn = nothing
err.clear
response.end
end if
dim expires,userpass
username=request("username")
userpass=md5(request("userpass"),16)
expires=request("issave")
if username<>"test" thenset rs=server.createobject("adodb.recordset")
rs.open"select * from lg50_my_user where username=""&username&"" and password=""&userpass&""",conn,1,3
if rs.eof and rs.bof then
rs.close
set rs=nothing
response.write("<script language=网页特效>alert("请输入正确用户名和密码");this.location.href="login.htm";</script>")
response.end
else
response.cookies(cookiesname)("username")=username
if int(expires)>0 then response.cookies(cookiesname).expires = date+expires
response.redirect ("index.asp")
end ifelse
response.cookies(cookiesname)("username")=username
response.redirect ("index.asp")
response.end
end if
%>
退出登录
<%
if request("out")="bbs" then
response.cookies(cookiesname)("username")=""
response.redirect "/www.111cn.net/login.asp?menu=out&bbs=bbs"
else
response.cookies(cookiesname)("username")=""
response.redirect ("login.htm")
end if
%>