一聚教程网:一个值得你收藏的教程网站

最新下载

热门教程

asp用户登录,退出登录函数

时间:2010-11-01 编辑:简简单单 来源:一聚教程网





<a target="_blank" href="/asp/asp.html">asp教程</a>用户登录,退出登录函数



       
 
   
 
 
   
 



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" then

set 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("")
 response.end
else
   response.cookies(cookiesname)("username")=username
   if int(expires)>0 then response.cookies(cookiesname).expires = date+expires
      response.redirect ("index.asp")
end if

else
   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.111com.net/login.asp?menu=out&bbs=bbs"
else
  response.cookies(cookiesname)("username")=""
  response.redirect ("login.htm")
end if
%> 
用户名:     
      密 码:     
保持登录:
     
      不保存
     
      保持一天
     
      保持一个月