📄 login.asp
字号:
<link href="style.css" type="text/css" rel="stylesheet">
<!--#include file="conn.asp"-->
<% if request("login")<>"" then
if request("usertype")<>"" then '用户类型不空,核实数据真实
If Request("usertype")="yk" Then
Session("usertype")="yk"
response.Write"<script>alert('来自"&Request.ServerVariables("REMOTE_ADDR")&"的游客,欢迎光临!');window.location.href='index.asp'</script>"
end if
If Request("usertype")="user" Then
sql = "select * from u where name='"&request("name")&"' and pwd='"&request("pwd")&"'"
Else
sql = "SELECT * FROM admin WHERE name='"&Request("name")&"' and pwd='"&Request("pwd")&"'"
End If
Set rs=db.execute(sql)
If not rs.EOF Or Not rs.BOF Then '输入数据存在
If Request("usertype")="user" Then
If rs("lock") Then
response.Write"<script>alert('用户被锁定或者未开通!');window.location.href='login.asp'</script>"
else
Session("usertype")="user"
Session("userid")=rs("id")
Session("name")=rs("name")
Response.Redirect("index.asp")
end if
Else
Session("usertype")="admin"
Session("adminid")=rs("id")
Session("name")=rs("name")
Response.Redirect("index.asp")
End If
Else
response.Write"<script>alert('输入错误!');window.location.href='login.asp'</script>"
rs.close
End if
end if
end if
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>lib</title>
</head>
<body>
<form name="form" method="POST" action="" >
<table width="333" height="133" border="0" align="center" cellpadding="4" cellspacing="1" >
<tr class="header" align="center">
<td height="26" colspan="2"><strong>用户登陆</strong> </td>
</tr>
<tr >
<td width="30%" nowrap > 用户名:</td>
<td>
<input name="name" type="text">
</td>
</tr>
<tr >
<td nowrap >密码:</td>
<td>
<input name="pwd" type="password" id="Text1" >
</td>
</tr>
<tr >
<td nowrap >用户类别:</td>
<td><select name="usertype" id="select" >
<option value="yk">游客</option>
<option value="user" >普通用户</option>
<option value="admin">管理员</option>
</select></td>
</tr>
<tr >
<td nowrap><a href="reg.asp" target="right">注册</a> </td>
<td>
<input type="submit" value="登陆">
<input type="reset" value="重写"></td><input type="hidden" name="login" value="form">
</tr>
</table></form></body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -