📄 login.asp
字号:
<!--#include file="conn.asp"-->
<!--#include file="md5.asp"-->
<%
if Session("open")=True then
Response.Redirect "main.asp"
end if
if request.form("username")<>"" and request.form("password")<>"" then
dim username
dim pwd
dim sql
dim rs
pwd=md5(trim(request.form("password")))
username=trim(request.form("username"))
if instr(username,"'")<>0 or instr(pwd,"'")<>0 then
response.write "不要用这种小猫猫的手段攻击我的网站! <a href=# onclick='javascript:window.history.go(-1)'>返回</a>"
response.end
end if
set rs = server.createobject("adodb.recordset")
sql="select * from admin where username='"&username&"' and password='"&pwd&"'"
rs.open sql,conn,1,1
if err.number <> 0 then
response.write "数据库操作失败:"&err.description
response.end
else
if not rs.eof and not rs.bof then
Session("open")=True
Session("admin_name")=rs("username")
Session("admin_password")=rs("password")
Response.Redirect "main.asp"
else
Session("open")=false
response.write "<div align=center>用户名或密码错误,请重新输入!</div>"
end if
end if
rs.close
set rs=nothing
end if
%>
<html>
<head>
<title>用户登陆</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body >
<form name="form1" method="post" action="">
<div align="center">
<table width="263" border="0">
<tr>
<td width="85" height="31" align="center">用户名:</td>
<td width="168"><input name="username" type="text" id="username" style="width:150px;height:25px"></td>
</tr>
<tr>
<td height="33" align="center">密 码:</td>
<td><input name="password" type="password" id="password" style="width:150px;height:25px"></td>
</tr>
<tr>
<td> </td>
<td align="center"><input type="submit" name="Submit" value="提交">
<input type="reset" name="Submit2" value="重置"></td>
</tr>
</table>
</div>
</form>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -