📄 login.asp
字号:
<!--#include file="../inc/md5.asp"-->
<!--#include file="../conn.asp"-->
<%
if request("action")="loginout" then
response.buffer=true
response.expires=0
Response.Cookies("9cool_name")=""
Response.Cookies("9cool_pwd")=""
Response.Cookies("9cool_time")=""
Response.Cookies("9cool_flag")=""
Response.redirect "login.asp"
end if
if Request.QueryString("action")="login" then
name=replace(request.form("name"),"'","")
pwd=md5(request.form("pwd"),32)
admincookies=request("CookieDate")
VerifyCode=replace(trim(Request.form("VerifyCode")),"'","")
If name="" or pwd="" or VerifyCode="" Then
ErrMsg("管理员、密码、验证码均不能为空!")
end if
if VerifyCode<>Session("VerifyCode") then
ErrMsg("请输入正确的验证码!")
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
select case admincookies
case "0"
Response.Cookies("9cool_name")=rs("username")
Response.Cookies("9cool_pwd")=rs("password")
Response.Cookies("9cool_time")=now()
Response.Cookies("9cool_flag")=rs("flag")
case 1
Response.Cookies("9cool_name")=rs("username")
Response.Cookies("9cool_pwd")=rs("password")
Response.Cookies("9cool_time")=now()
Response.Cookies("9cool_flag")=rs("flag")
Response.Cookies("9cool_name").Expires=Date+1
Response.Cookies("9cool_pwd").Expires=Date+1
Response.Cookies("9cool_flag").Expires=Date+1
case 2
Response.Cookies("9cool_name")=rs("username")
Response.Cookies("9cool_pwd")=rs("password")
Response.Cookies("9cool_time")=now()
Response.Cookies("9cool_flag")=rs("flag")
Response.Cookies("9cool_name").Expires=Date+31
Response.Cookies("9cool_pwd").Expires=Date+31
Response.Cookies("9cool_flag").Expires=Date+31
case 3
Response.Cookies("9cool_name")=rs("username")
Response.Cookies("9cool_pwd")=rs("password")
Response.Cookies("9cool_time")=now()
Response.Cookies("9cool_flag")=rs("flag")
Response.Cookies("9cool_name").Expires=Date+365
Response.Cookies("9cool_pwd").Expires=Date+365
Response.Cookies("9cool_flag").Expires=Date+365
end select
Response.Redirect("index.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
ErrMsg("对不起,用户名或密码错误,或者帐号已被锁定!")
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: #0066CC;
BACKGROUND-COLOR: #FFFFFF;
border: 1px solid #999999;
font-family: Arial;
}
.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;
}
-->
</style>
</HEAD>
<BODY leftMargin=0 topMargin=0 oncontextmenu="return false" ondragstart="return false" onselectstart="return false">
<TABLE height="100%" cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD>
<TABLE cellSpacing=0 cellPadding=0 width=372 align=center border=0>
<TBODY>
<TR>
<TD height="45" colSpan=3 background="images/EwUser_Title.gif"><br> <table width="50%" border="0" align="right" cellpadding="0" cellspacing="0">
<tr>
<td align="center" style="color:ffffff ">2006年3月20日 星期一</td>
</tr>
</table></TD>
</TR>
<TR>
<TD vAlign=top align=left width=16 rowSpan=2><IMG height=187
src="images/EwUser_Left.gif" width=16></TD>
<TD height=175>
<TABLE cellSpacing=0 cellPadding=0 width=348 border=0>
<form name="login" action="?action=login" METHOD="post" target="_top" onSubmit="javascript:login.submit.disabled=true;">
<TBODY>
<TR>
<TD height=144>
<TABLE
width=314 height=107 border=1 align="center" cellPadding=0 cellSpacing=0
borderColor=#e0e1db id=AutoNumber1 style="BORDER-COLLAPSE: collapse">
<TBODY>
<TR>
<TD bgColor=#efefef>
<TABLE cellSpacing=0 cellPadding=0 width="100%"
border=0>
<TBODY>
<TR>
<TD align=right width="30%" height=30>用户名:</TD>
<TD width="70%" height=30><INPUT class=input
id=UserName5 maxLength=20 name=name></TD></TR>
<TR>
<TD align=right height=30>密 码:</TD>
<TD height=30><INPUT class=input id=Password3
type=password maxLength=20 name=pwd></TD></TR>
<TR>
<TD align=right height=30><font
color=#000000>验证码</font>:</TD>
<TD height=30><input name=verifycode class=input size="8">
<img src="../inc/VerifyCode.asp" alt="验证码,看不清楚?请点击刷新验证码" style=cursor:pointer onClick="this.src='../inc/VerifyCode.asp'"></TD>
</TR>
<TR>
<TD align=right height=30>Cookie:</TD>
<TD height=30><select name="CookieDate" size="1" id="CookieDate"><option value="0">不保存</option><option value="1">保存一天</option><option value="2">保存一月</option><option value="3">保存一年</option></select></TD>
</TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR>
<TR>
<TD vAlign=top align=center height=31><INPUT name=submit type=submit class="button" id="submit" value=" 登陆 ">
<INPUT name=reset type=reset class="button" id="reset" value=" 取消 "></TD>
</TR></TBODY></form></TABLE></TD>
<TD vAlign=top width=8 rowSpan=2><IMG height=187
src="images/EwUser_Right.gif" width=8></TD></TR>
<TR>
<TD width=348 height=12><IMG height=12
src="images/EwUser_Bottom.gif"
width=348></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -