28,390
社区成员
发帖
与我相关
我的任务
分享
<!--#include file="../include/function.asp"-->
<%
'当有账号在线,要求重新登入
response.charset = "GBK"
if session("Admin") <> "" then
call errorHistoryBack("必须退出当前帐号再登陆")
end if
'接收登录信息
if request.form("submit") = "登录" then
dim adminname,adminpass,yzm
adminname = request.form("admin_name")
adminpass = request.form("admin_pass")
yzm = request.form("yzm")
if len(adminname) <2 then
call errorHistoryBack("用户名不得少于2位")
end if
if len(adminpass) < 6 then
call errorHistoryBack("密码不得少于6位")
end if
if len(yzm) <> 4 then
call errorHistoryBack("验证码必须是4位",1)
end if
if not isnumeric(yzm) then
call errorHistoryBack("验证码必须是数字")
end if
'判断服务器中的验证码信息
if cint(yzm) <> Session("GetCode") then
call errorHistoryBack("验证码错误")
end if
'判断数据库里的字段是否正确
%>
<!--#include file="../Data/conn.asp"-->
<!--#include file="../CheckCode/md5.asp"-->
<%
dim rs,sql
set rs = server.createobject("adodb.recordset")
sql = "select * from Admin where AdminName='"&adminname&"' and AdminPass='"&md5(adminpass)&"'"
rs.open sql,conn,1,1
if not rs.eof then
'数据正确
session("Admin") = adminname
response.redirect "admin_index.asp"
else
'数据不正确
call close_rs
call close_conn
call errorHistoryBack("用户名或密码不正确")
end if
call close_rs
call close_conn
end if
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>登入页-login</title>
<link href="css/login.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/login2.js"></script>
</head>
<body>
<div id="login-box">
<div class="login-top">管理登入</div>
<div class="login-main">
<form name="login" action="admin_login.asp" method="POST" id="login">
<p><label for="admin_name">用户名</label>
<input name="admin_name" type="text" id="admin_name" class="text">
</p>
<p><label for="admin_pass">密 码</label>
<input name="admin_pass" type="password" id="admin_pass" class="text">
</p>
<p><label for="yzm">验证码</label>
<input name="yzm" type="text" id="yzm" class="text1">
<img src="../CheckCode/GetCode.asp" onclick="javascript:this.src='../CheckCode/GetCode.asp?tm='+Math.random()" style="cursor:pointer" alt="验证码" />
</p>
<input name="submit" type="submit" class="submit" value="登录" onclick="return check();">
<input name="submit2" type="reset" class="submit" value="重置">
</form>
</div>
<div class="login-power">
Powered by<strong>菲戈</strong></a>© 2011 feige Inc.
</div>
</div>
</body>
</html>
<%
dim conn
set conn = server.createobject("adodb.connection")
conn.connectionstring="Provider = Microsoft.Jet.OLEDB.4.0;Data Source="&server.mapPath("../Data/data.mdb")
conn.open
sub close_conn
conn.close
set conn = nothing
end sub
sub close_rs
rs.close
set rs = nothing
end sub
%>