⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 login.asp

📁 基于asp的网站管理系统,课直接下载使用,对初学者有恨大帮助,希望对大家有用
💻 ASP
字号:
<!--#include file="include/conn.asp"-->
<link rel=stylesheet href='include/class.css' type=text/css>
<% if request("action")="chk" then %>
<%
on error resume next
user=trim(request.form("user"))
pass=trim(request.form("pass"))
if instr(user,"&")>0 or instr(user,"=")>0 then
	response.write "<font color=red><center>用户名称包含非法字符!</center></font>"
	response.end
end if
if instr(pass,"&")>0 or instr(pass,"=")>0 then
	response.write "<font color=red><center>密码包含非法字符!</center></font>"
	response.end
end if
if user="" or pass=""  then
	response.write "<font color=red><center>用户名称和密码不能为空</center></font>"
	response.end
end if

set rs=server.createobject("adodb.recordset")
dim red
    sql="select * from user where user='"&user&"' and pass='"&pass&"'"
    set rs=db.execute(sql)
    if rs.eof and rs.bof then
      red="<center>您输入的 <font color=red>用户名称</font> 和 <font color=red>登陆密码</font>  有错误!<br>"&"请重新输入以并继续登陆本站!<br><a href=index.asp>返回首页重新登录</a></center>"
      response.write red
    else
        response.cookies("user")("username")=user
        response.cookies("user")("realname")=rs("realname")
        response.cookies("user")("password")=pass
        sql="update user set islogin='1' where user='"&user&"'"
        db.execute(sql)
	response.redirect "index.asp"
      end if

%>
<% end if %>

<% if request("action")="out" then %>
<%
on error resume next
  if request.cookies("user")("username")<>"" then
    user=request.cookies("user")("username")
   sql="update user set islogin='0' where user='"&user&"'"
   db.execute(sql)
  response.cookies("user")("username")=""
  response.cookies("user")("realname")=""
  response.cookies("user")("password")=""
  response.write "<center><font color=red>你已经成功退出登录!欢迎你再次登录本站!</font><br><br><a href=index.asp>返回首页</a></center>"
   else
  response.write "<center><font color=red>你还没有登录本站呢!</font></center>"
  end if
%>
<% end if %>
<% if request("action")="nopass" then %>
<% if request.form("user")="" then%>
<form action='' method=post>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;用户名称:&nbsp;&nbsp;<input type=text name=user size=19>&nbsp;&nbsp;&nbsp;&nbsp;请输入你的用户名称!<br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;密码钥匙:&nbsp;&nbsp;<input type=password name=pass1 size=20 maxlength=20>&nbsp;&nbsp;&nbsp;&nbsp;请输入你的密码钥匙!<br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;新的密码:&nbsp;&nbsp;<input type=password name=pass size=20 maxlength=20>&nbsp;&nbsp;&nbsp;&nbsp;请输入你的新密码!<br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;重复密码:&nbsp;&nbsp;<input type=password name=pass2 size=20 maxlength=20>&nbsp;&nbsp;&nbsp;&nbsp;请再确认一次你的新密码!<br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type=submit value='下 一 步'>
</form>
<%end if%>

<% 
on error resume next
if request.form("user")<>"" then
  dim user,pass,pass1,pass2,pass_chk
  user=trim(request.form("user"))
  pass=trim(request.form("pass"))
  pass1=trim(request.form("pass1"))
  pass2=trim(request.form("pass2"))
  pass_chk=""
if instr(user,"&")>0 or instr(user,"=")>0 then
	response.write "<center><font color=red>用户名称包含非法字符!</font><br><br><a href='login.asp?action=nopass'>返回重填</a></center>"
	response.end
end if
if instr(pass1,"&")>0 or instr(pass1,"=")>0 then
	response.write "<center><font color=red>密码钥匙包含非法字符!</font><br><br><a href='login.asp?action=nopass'>返回重填</a></center>"
	response.end
end if
if instr(pass,"&")>0 or instr(pass,"=")>0 then
	response.write "<center><font color=red>密码包含非法字符!</font><br><br><a href='login.asp?action=nopass'>返回重填</a></center>"
	response.end
end if
  if user="" then
    pass_chk="您输入的 <font color=red>登陆名称</font> 为空或不符合相关规则!<br><br>"
response.write "<center>"&pass_chk&"<br><br><a href='login.asp?action=nopass'>返回重填</a></center>"
  end if
  if pass1="" then
    pass_chk="您输入的 <font color=red>密码钥匙</font> 为空或不符合相关规则!<br><br>"
response.write "<center>"&pass_chk&"<br><br><a href='login.asp?action=nopass'>返回重填</a></center>"
  end if
  if pass="" then
    pass_chk="您输入的 <font color=red>登陆密码</font> 为空或不符合相关规则!<br><br>"
response.write "<center>"&pass_chk&"<br><br><a href='login.asp?action=nopass'>返回重填</a></center>"
  else
    if pass<>pass2 then
      pass_chk="<font corlor=red>登陆密码</font> 和 <font corlor=red>确认密码</font> 不一致!<br><br>"
response.write "<center>"&pass_chk&"<br><br><a href='login.asp?action=nopass'>返回重填</a></center>"
    end if
  end if
  sql="select top 1 pass from user where user='"&user&"' and pass1='"&pass1&"'"
  set rs=server.createobject("adodb.recordset")
  rs.open sql,db,1,3
  if rs.eof and rs.bof then
    pass_chk="<font color=red>登陆名称</font> 和 <font color=red>密码钥匙</font> 有错!<br><br>"
response.write "<center>"&pass_chk&"<br><br><a href='login.asp?action=nopass'>返回重填</a></center>"
  end if
  rs("pass")=pass
  rs.update
if pass_chk="" then
  pass_chk="<font color=red><b>"&user&"</b></font>,<font color=red>您已成功修改了您的密码!</font><br><br>新密码是:<font color=red>"&pass2&"</font> 请牢记!<br><br><a href='index.asp'>点击返回首页进行登录</a>"
response.write "<center>"&pass_chk&"</center>"
end if

end if
%>
<% end if %>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -