📄 login.asp
字号:
<!--#include file="conn.asp"-->
<!--#include file="md5.asp"-->
<!--#include file="Function.asp"-->
<%
Dim user,pass,yz
if Request.QueryString("act")="login" then
user = Request.Form("username")
pass = Request.Form("password")
If user<>"" and pass<>"" Then
If not IsNumeric(Request.Form("yz")) Then
Response.Write "<script>alert('你输入的验证码为非数字!');window.location.href('login.asp');</script>"
Response.End
End If
If (int(Session("SafeCode"))=int(Request.Form("yz"))) Then
Set rs=Server.CreateObject("Adodb.RecordSet")
sql="Select * from Admin where adminname='"&user&"' and password='"&md5(pass)&"'"
rs.open sql,conn,1,1
If not(rs.bof and rs.eof) Then
If md5(pass)=rs("password") and user=rs("adminname") Then
Session("user")=rs("adminname")
rs.close
Set rs=nothing
Response.Redirect "admin.asp"
Else
Response.Write "<script>alert('登陆失败,用户名或密码错误!');window.location.href('login.asp');</script>"
End If
Call EndConnection()
Else
Response.Write "<script>alert( '登陆失败!用户名或密码不存在!');window.location.href('login.asp');</script>"
End If
Call EndConnection()
Else
Response.Write "<script>alert('登陆失败!验证码输入错误!');window.location.href('login.asp');</script>"
End If
Else
Response.Write "<script>alert('登陆失败!用户名和密码不能为空!');window.location.href('login.asp');</script>"
End If
End If
%>
<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>管理员登录</title>
<link rel="stylesheet" type="text/css" href="css.css">
<script language="VBScript">
function check()
If form1.username.value="" Then
alert("用户名不能为空!")
form1.username.focus()
return false
End If
If form1.password.value="" Then
alert("密码不能为空!")
form1.password.focus()
return false
End If
If form1.yz.value="" Then
alert("验证码不能为空!")
form1.yz.focus()
return false
End If
return true
End Function
</script>
</head>
<body>
<div align="center">
<p> </p>
<table border="0" width="100%" id="table1" cellspacing="0" cellpadding="0" height="200">
<tr>
<td>
<div align="center">
<table border="0" width="50%" id="table2" cellspacing="1" cellpadding="3" class="tableborder">
<form action=login.asp?act=login method=post name=form1 onsubmit="return check()">
<tr>
<th colspan="2">管理员登录</th>
</tr>
<tr>
<td width="40%" align="right"><b>用户名:</b></td>
<td><input type="text" name="username"></td>
</tr>
<tr>
<td width="40%" align="right"><b>密 码:</b></td>
<td><input type="password" name="password" size="21"></td>
</tr>
<tr>
<td align="right"><b>验证码:</b></td>
<td><input type="text" name="yz" size="8"> <%Call GetSafeCode()%></td>
</tr>
<tr>
<td colspan="2" align="center" class="tablebody"><input type=submit name=submit value=登录> <input type="reset" name="reset" value="取消"></td>
</tr>
</form>
</table>
</div>
</td>
</tr>
</table>
</div>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -