📄 login.asp
字号:
<!--#include file="../inc/md5.asp"-->
<!--#include file="../inc/conn.asp"-->
<!--#include file="../inc/char.inc"-->
<%
if request("action")="loginout" then
response.buffer=true
response.expires=0
Response.Cookies("name")=""
Response.Cookies("pwd")=""
Response.Cookies("time")=""
Response.Cookies("flag")=""
Response.write "<script>alert('已经成功退出!');top.location.href='login.asp'</script>"
end if
if Request.QueryString("action")="login" then
name=htmlencode2(replace(request.form("name"),"'",""))
pwd=htmlencode2(md5(request.form("pwd")))
code=replace(trim(Request.form("code")),"'","")
If name="" or pwd="" or code="" Then
Response.Write("<script language=javascript>alert('对不起,管理员、密码、验证码均不能为空!');history.go(-1);</script>")
Response.End
end if
If code<>CStr(session("CheckCode")) Then
Response.Write("<script language=javascript>alert('对不起,请输入正确的验证码!');history.go(-1);</script>")
Response.End
end if
loginip=Request.ServerVariables("HTTP_X_FORWARDED_FOR")
if loginip= "" then loginip=Request.ServerVariables("REMOTE_ADDR")
thesoft=Request.ServerVariables("HTTP_USER_AGENT")
if instr(thesoft,"Windows NT 5.0") then
vOS="Win2000"
elseif instr(thesoft,"Windows NT 5.2") then
vOs="Win2003"
elseif instr(thesoft,"Windows NT 5.1") then
vOs="WinXP"
elseif instr(thesoft,"Windows NT") then
vOs="WinNT"
elseif instr(thesoft,"Windows 9") then
vOs="Win9x"
elseif instr(thesoft,"unix") or instr(thesoft,"linux") or instr(thesoft,"SunOS") or instr(thesoft,"BSD") then
vOs="类Unix"
elseif instr(thesoft,"Mac") then
vOs="Mac"
else
vOs="Other"
end if
sql="select * from manage_user where username='"&name&"' and password='"&pwd&"' and lock=0"
rs.open sql,conn,1,3
If not rs.eof = True Then
rs("logintime")=Now()
rs("loginip")=loginip
rs.update
Response.Cookies("name") = rs("username")
Response.Cookies("pwd") = rs("password")
Response.Cookies("time") = now()
Response.Cookies("flag") = rs("flag")
Response.Redirect("default.asp")
else
set rs2=server.createobject("adodb.recordset")
sql2="select * from log"
rs2.open sql2,conn,1,3
rs2.AddNew
rs2("type")="非法登录"
rs2("username")=name
rs2("password")=request.form("pwd")
rs2("loginip")=loginip
rs2("os")=vOs
rs2("time")=now()
rs2.update
rs2.Close
set rs2=nothing
Response.write"<script>alert('对不起,用户名或密码错误,或者帐号已被锁定!');history.go(-1);</script>"
end if
end if
%>
<HTML>
<HEAD>
<TITLE>管理登录</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<style type="text/css">
<!--
td {font-size: 10pt;}
.input {
FONT-SIZE: 12px;
COLOR: #000000;
BACKGROUND-COLOR: #FFFFFF;
border: 1px solid #999999;
}
.button {
font-size: 12px;
color: #313031;
border-top-width: 1px;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 1px;
border-top-style: solid;
border-right-style: solid;
border-bottom-style: solid;
border-left-style: solid;
border-top-color: #FFFFFF;
border-right-color: #a2a2a2;
border-bottom-color: #a2a2a2;
border-left-color: #FFFFFF;
background-color: #eeeeee;
cursor:hand;
}
-->
</style>
<script language="JavaScript">
function IsDigit(){
return ((event.keyCode >= 48) && (event.keyCode <= 57));
}
</script>
</HEAD>
<BODY leftMargin=0 topMargin=0 oncontextmenu="return false" ondragstart="return false" onselectstart="return false">
<table width="100%" height="80%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="300" align="center" valign="middle"><TABLE height=300 cellSpacing=0 cellPadding=0 width=400 align=center border=0>
<TBODY>
<TR>
<TD valign="bottom" background=images/login.gif><table height=135 cellspacing=0 cellpadding=4 width="74%"
align=center border=0>
<form name="login" action="?action=login" METHOD="post" target="_top" onSubmit="javascript:login.button.disabled=true;">
<tr>
<td width="40%" align="right"> 管理员:</td>
<td width="60%"><input name="name" class="input" size="14" maxlength=20> </td>
</tr>
<tr>
<td align="right">密 码:</td>
<td><input name="pwd" type=password class="input" size="14" maxlength=20></td>
</tr>
<tr>
<td align="right">验证码: </td>
<td><input name="code" type="text" class="input" ONKEYPRESS="event.returnValue=IsDigit();" size=6>
<img src="../inc/getcode.asp"> </td>
</tr>
<tr align="center" valign="top">
<td height=50 colspan=2>
<input name=button type=submit class="button" id="button" value=" 登 录 " >
<input name=reset type=button class="button" onclick=location.href='../index.asp' value=" 返 回 "></td>
</tr>
</form>
</table>
</TD>
</TR>
</TABLE></td>
</tr>
</table>
</BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -