📄 admin_login.asp
字号:
<!--#include file="setup.asp"-->
<!--#include file="../inc/md5.asp"-->
<%
'=====================================================================
' 软件名称:新云网站管理系统
' 当前版本:NewCloud Site Management System Version 2.1
' 文件名称:admin_login.asp
' 更新日期:2004-10-20
'=====================================================================
' 产品咨询:Tel:027-85777659,QQ:94022511,Email:web@newcloud.net
' 程序开发:新云软件开发组
' 论坛支持:新云论坛(http://bbs.newasp.net)
' 官方网站:新云网络(www.newasp.net www.newasp.cn)
'=====================================================================
' Copyright 2002-2005 newasp.net - All Rights Reserved.
' newasp is a trademark of newasp.net
'=====================================================================
Response.CacheControl = "no-cache"
Dim RefreshTime,GetCode
FoundErr = False
RefreshTime = 3 '设置防刷新时间
If DateDiff("s", Session("UserTime"), Now()) < RefreshTime Then
Response.Write "<META http-equiv=Content-Type content=text/html; chaRset=gb2312><meta HTTP-EQUIV=REFRESH CONTENT="&RefreshTime&"><br>本页面起用了防刷新机制,请不要在"&RefreshTime&"秒内连续刷新本页面<BR>正在打开页面,请稍后……"
Response.End
End If
FoundErr = False
Select Case Newasp.CheckStr(Request("action"))
Case "logout" '退出系统
Call logout()
Case "login" '登陆系统
Call chklogin()
Case Else
Call main()
End Select
If Founderr = True Then
Session("UserTime") = Now()
SaveLogInfo("非法登陆!")
Response.Redirect("showerr.asp?action=error&message=" & Server.URLEncode(ErrMsg) & "")
End If
CloseConn
Sub main()
If Session("AdminName") = "" Then
%>
<html>
<head>
<title>管理员登陆</title>
<meta http-equiv="Content-Type" content="text/html; chaRset=gb2312">
<link rel="stylesheet" href="Style.css" type="text/css">
</head>
<script language="javascript">
<!--//
function SetFocus()
{
if (document.myform.AdminName.value=="")
document.myform.AdminName.focus();
else
document.myform.AdminName.select();
}
function CheckForm()
{
if(document.myform.AdminName.value=="")
{
alert("请输入您的用户名!");
document.myform.AdminName.focus();
return false;
}
if(document.myform.PassWord.value == "")
{
alert("请输入您的密码!");
document.myform.PassWord.focus();
return false;
}
if (document.myform.verifycode.value==""){
alert ("请输入您的验证码!");
document.myform.verifycode.focus();
return(false);
}
}
function CheckBrowser()
{
var app=navigator.appName;
var verStr=navigator.appVersion;
if (app.indexOf('Netscape') != -1) {
alert("新云网络友情提示:\n 你使用的是Netscape浏览器,可能会导致无法使用后台的部分功能。建议您使用 IE6.0 或以上版本。");
}
else if (app.indexOf('Microsoft') != -1) {
if (verStr.indexOf("MSIE 3.0")!=-1 || verStr.indexOf("MSIE 4.0") != -1 || verStr.indexOf("MSIE 5.0") != -1 || verStr.indexOf("MSIE 5.1") != -1)
alert("新云网络友情提示:\n 您的浏览器版本太低,可能会导致无法使用后台的部分功能。建议您使用 IE6.0 或以上版本。");
}
}
//-->
</script>
<body topmargin="0" leftmargin="0" rightmargin="0">
<div align="center"><BR>
<p> </p> <p> </p>
<form name=myform method="post" action="?action=login" target="_top" onSubmit="return CheckForm();">
<table cellpadding="1" cellspacing="0" border="0" align=center style="border: outset 3px;width:0;">
<tr><td>
<table width="605" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><img src="images/admin_login_r1_c1.jpg" width="605" height="17"></td>
</tr>
</table>
<table width="605" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="24"><img src="images/admin_login_r2_c1.jpg" width="23" height="212"></td>
<td width="494" align="center" valign="top" bgcolor="#F7FAFF"><table width="100%" height="100" border="0" cellpadding="0" cellspacing="0">
<tr>
<td background="images/admin_login_r2_c2.jpg"><a href="http://www.newasp.net" target="_blank"><img src="images/admin_login_r2_c2.jpg" alt="新云网站管理系统 ver 2.0.0" width="494" height="101" border="0"></a></td>
</tr>
</table>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="5">
<tr>
<td width="22%" align="center" rowspan="4"><a href="http://www.newasp.net" target="_blank"><img src="images/logo1.gif" alt="新云网络" width="88" height="31" border="0"></a></td>
<td width="78%">用户名:<input name="AdminName" type="text" size="28" onmouseover="this.style.background='#FFFFFF';" onmouseout="this.style.background='#F8F8F8'" onFocus="this.select();"></td>
</tr>
<tr>
<td>密 码:<input name="PassWord" type="password" size="22" onmouseover="this.style.background='#FFFFFF';" onmouseout="this.style.background='#F8F8F8'" onFocus="this.select();">
<%If IsAdminValidate Then%>认证码: <input name="validate" type="password" size="12" onmouseover="this.style.background='#FFFFFF';" onmouseout="this.style.background='#F8F8F8'" onFocus="this.select();"><%End If%></td>
</tr>
<tr>
<td>附加码:<input name="verifycode" type="text" size="10" maxlength="5" value="<%If GetCode=9999 Then Response.Write "9999"%>" onmouseover="this.style.background='#FFFFFF';" onmouseout="this.style.background='#F8F8F8'" onFocus="this.select(); ">
请在附加码框输入 <img src="../inc/getcode.asp" alt="验证码,看不清楚?请点击刷新验证码" height="10" style="cursor : pointer;" onclick="this.src='../inc/getcode.asp'" /> </td>
</tr>
<tr>
<td><input type="button" name="Submit4" onclick=window.location.reload() value="刷新本页" class="button">
<input type="button" name="Submit1" onclick="javascript:location.href='../'" value="返回首页" class="button">
<input type="submit" name="Submit" value="管理登陆" class="button"></td>
</tr>
</table> </td>
<td width="88"><img src="images/admin_login_r2_c3.jpg" width="88" height="212" /></td>
</tr>
</table>
<table width="605" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><img src="images/admin_login_r4_c1.jpg" width="605" height="21" /></td>
</tr>
</table>
</td></tr></table></form>
<script language="JavaScript">
<!--
CheckBrowser();
SetFocus();
-->
</script>
<p align=center></p>
</div>
<%
Else
Response.Redirect "admin_index.asp"
End If
End Sub
Sub logout()
'清除COOKIES中管理员身份的验证信息.
Session.Abandon
Session("AdminName") = ""
Session("AdminPass") = ""
Session("AdminGrade") = ""
Session("AdminFlag") = ""
Session("AdminStatus") = ""
Session("AdminID") = ""
Session("AdminRandomCode") = ""
Response.Cookies(Admin_Cookies_Name) = ""
Response.Redirect ("../")
End Sub
Sub chklogin()
Dim adminname, password,RandomCode
adminname = Newasp.CheckBadstr(Request("adminname"))
password = md5(Trim(Replace(Request("password"), "'", "")))
If Newasp.CheckPost = False Then
ErrMsg = ErrMsg + "您提交的数据不合法,请不要从外部提交登陆。"
Founderr = True
End If
If Newasp.IsValidStr(Request("adminname")) = False Then
ErrMsg = ErrMsg + "<li>用户名中含有非法字符。</li>"
Founderr = True
End If
If Newasp.IsValidPassword(Request("password")) = False Then
ErrMsg = ErrMsg + "<li>密码中含有非法字符。</li>"
Founderr = True
End If
If IsAdminValidate Then
If Trim(Request.Form("validate")) <> AdminValidateCode Or Trim(Request.Form("validate")) = "" Then
ErrMsg = ErrMsg+"<li>您输入的认证码或者密码错误,请重新输入!</li>"
Founderr = true
Exit Sub
End if
End If
If Request("verifycode") = "" Then
ErrMsg = ErrMsg + "<br>" + "<li>请返回输入确认码。</li>"
Founderr = True
ElseIf Session("getcode") = "9999" Then
Session("getcode") = ""
ErrMsg = ErrMsg + "<br>" + "<li>请不要重复提交,如需重新登陆请返回登陆页面。</li>"
Founderr = True
ElseIf CStr(Session("getcode"))<>CStr(Trim(Request("verifycode"))) Then
ErrMsg = ErrMsg + "<br>" + "<li>您输入的认码和系统产生的不一致,请重新输入。</li>"
Founderr = True
End If
Session("getcode") = ""
If adminname = "" Or password = "" Then
Founderr = True
ErrMsg = ErrMsg + "<br>" + "<li>请输入您的用户名或密码。</li>"
Exit Sub
End If
If Founderr = True Then Exit Sub
If Not IsObject(Conn) Then ConnectionDatabase
Set Rs = Server.CreateObject("ADODB.Recordset")
SQL = "SELECT * FROM NC_Admin WHERE password='" & password & "' And username='" & adminname & "'"
Rs.Open SQL, Conn, 1, 3
If Rs.BOF And Rs.EOF Then
FoundErr = True
ErrMsg = ErrMsg + "<li>您输入的用户名和密码不正确或者您不是系统管理员。!</li>"
Exit Sub
Else
If password <> Rs("password") Then
FoundErr = True
ErrMsg = ErrMsg + "<br><li>用户名或密码错误!!!</li>"
Exit Sub
End If
If Rs("isLock") <> 0 Or Rs("isLock") = "" Then
Founderr = True
ErrMsg = "<li>你的用户名已被锁定,你不能登陆!如要开通此帐号,请联系管理员。</li>"
Exit Sub
End If
End If
RandomCode = Newasp.GetRandomCode
Rs("LoginTime") = Now()
Rs("Loginip") = Newasp.GetUserip
Rs("RandomCode") = RandomCode
Rs.Update
If FoundErr = False Then
Session("AdminName") = Rs("username")
Session("AdminPass") = Rs("password")
Session("AdminGrade") = Rs("AdminGrade")
Session("Adminflag") = Rs("Adminflag")
Session("AdminStatus") = Rs("Status")
Session("AdminRandomCode") = RandomCode
Session("AdminID") = Rs("id")
If IsAdminValidate Then
Session("validate") = Trim(Request.Form("validate"))
End If
If UseAdminCookies Then
Response.Cookies(Admin_Cookies_Name)("AdminName") = Rs("username")
Response.Cookies(Admin_Cookies_Name)("AdminPass") = Rs("password")
Response.Cookies(Admin_Cookies_Name)("AdminGrade") = Rs("AdminGrade")
Response.Cookies(Admin_Cookies_Name)("Adminflag") = Rs("Adminflag")
Response.Cookies(Admin_Cookies_Name)("AdminStatus") = Rs("Status")
Response.Cookies(Admin_Cookies_Name)("RandomCode") = RandomCode
Response.Cookies(Admin_Cookies_Name)("AdminID") = Rs("id")
If IsAdminValidate Then
Response.Cookies(Admin_Cookies_Name)("validate") = Trim(Request.Form("validate"))
End If
End If
End If
Rs.Close
Set Rs = Nothing
Response.Redirect("admin_index.asp")
End Sub
Function GetCode1()
Dim Test
On Error Resume Next
Set Test = Server.CreateObject("Adodb.Stream")
Set Test = Nothing
If Err Then
Dim zNum
Randomize Timer
zNum = CInt(8999 * Rnd + 1000)
Session("GetCode") = zNum
getcode1 = Session("GetCode")
Else
getcode1 = "<img src=""../inc/getcode.asp"">"
End If
End Function
%>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -