⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 login.asp

📁 1.支持文章
💻 ASP
字号:
<%option explicit%>
<!--#include file="../Conn.asp"-->
<!--#include file="../SysCls/KS_CommonCls.asp"-->
<!--#include file="ChkCode.asp"-->
<%
'强制浏览器重新访问服务器下载页面,而不是从缓存读取页面
Response.Buffer = True
Response.Expires = -1
Response.ExpiresAbsolute = Now() - 1
Response.Expires = 0
Response.CacheControl = "no-cache"
Dim KSCMS,SoftKeyBoardTF
On Error Resume Next
Set KSCMS=New CommonCls
IF Request.QueryString("Action")="" Then
 SoftKeyBoardTF=KSCMS.GetConfig("SoftKeyBoardTF")
 Call Main
ElseIF Request.QueryString("Action")="LoginCheck" Then
 Call CheckLogin
Else 
  Response.End()
End if
%>
<%Sub Main()%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE><%=KSCMS.GetConfig("WebName") & "---网站后台管理"%></TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<script language="JavaScript" type="text/JavaScript" src="js/SoftKeyBoard.js"></script>
<link href="Inc/Admin_Style.CSS" rel="stylesheet" type="text/css">

<STYLE>
body {font-family: "宋体";font-size: 12px;text-decoration: none;}
td {font-size: 12px;color: #666666;text-decoration: none;line-height: 18px;font-family: "宋体";}
.login {
	height: 15px;
	width: 100px;
	background-color: #fefefe;
	font-family: "Tahoma";
	font-size: 11px;
	color: #333333;
	text-decoration: none;
	border: 1px solid #FFFFFF;
}
.login1 {
	height: 15px;
	width: 40px;
	left:20px;
	background-color: #fefefe;
	font-family: "Tahoma";
	font-size: 11px;
	color: #333333;
	text-decoration: none;
	border: 1px solid #FFFFFF;
}
.S1{
font-family: "宋体"; 
font-weight: bold; 
color: #ffffff; 
font-size:16px;
text-decoration: none}
</STYLE>
<META content="MSHTML 6.00.3790.2577" name=GENERATOR>
</HEAD>
<BODY bgColor=#ffffff leftMargin=0 background=Images/login.gif topMargin=0 scroll=no MARGINWIDTH="0" MARGINHEIGHT="0">
<CENTER>
<DIV align=left>
<TABLE height=520 cellSpacing=0 cellPadding=0 border=0>
  <TBODY>
  <TR>
    <TD align=left rowSpan=2>
      <FORM ACTION="Login.asp?Action=LoginCheck" METHOD="post" name="LoginForm" onSubmit="return(CheckForm(this))">
      <DIV align=left>
      <TABLE id=table3 height=490 cellSpacing=0 cellPadding=0 width=100%  border=0>
        <TBODY>
        <TR vAlign=bottom align=middle>
          <TD height="150" colSpan=2 align="center">&nbsp;</TD>
          <TD colSpan=2 valign="bottom">&nbsp;</TD>
        </TR>
        <TR vAlign=bottom align=middle>
          <TD height="180" colSpan=2 align="center">&nbsp;</TD>
          <TD colSpan=2 valign="bottom"><table width="445" border="0" cellspacing="0" cellpadding="0" bordercolor="#AAAAAA" height="108">
            <tr bgcolor="F7E4D6">
              <td height="6" colspan="3" valign="top" bordercolor="#FDFEFF" bgcolor="#195D92"><img src="images/1.gif" width="6" height="6"></td>
              </tr>
            <tr bgcolor="#FFFFFF">
              <td width="7" align="center" bgcolor="#195D92"></td>
              <td align="center"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td width="87" rowspan="3" align="center"><img src="Images/login3.gif" width="57" height="55"></td>
                  <td width="53" height="30"><div align="right">登录名:</div></td>
                  <td width="140" valign="middle" nowrap background="images/bg_pa.gif"><center>
                    <input type="text" name="UserName" tabindex="1" size="15" class="login">
                  </center></td>
                  <td rowspan="3"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td><input onMouseOver=nereidFade(this,100,10,5)  style="FILTER:alpha(opacity=50)" onMouseOut=nereidFade(this,50,10,5) src="images/dl.gif"  type="image" tabindex="5" name="enter" width="52" height="54" border="0"></td>
                    </tr>
					<%if EnableSiteManageCode = True Then%>
                    <tr>
                      <td height="25" background="images/bg_pa2.gif">认证码:
                        <input name="AdminLoginCode" type="password" class="login1" id="AdminLoginCode" <%if EnableSiteManageCode = True And SiteManageCode = "kesion2006" then%> title="认证码初始值“kesion2006”,为了系统的安全请及时修改admin目录下的chkcode.asp文件参数!"<%end if%> tabindex="4" size="5"></td>
                    </tr>
                    <%end if%>
                  </table>
                  </td>
                </tr>
                <tr>
                  <td height="30"><div align="right">密 码:</div></td>
                  <td nowrap background="images/bg_pa.gif"><center>
				       <%IF SoftKeyBoardTF=1 Then%>
                      <input onKeyDown="Calc.password.value=this.value;" tabindex="2" onFocus="this.select();" onClick="password1=this;showkeyboard();this.readOnly=1;Calc.password.value=''"  readOnly type="password" onChange="Calc.password.value=this.value;"  name="PWD"  size="18" class="login">
					   <%Else%>
					   <INPUT name="PWD"  type="password" tabindex="2" class="login">
					   <%End IF%>
                  </center></td>
                </tr>
                <tr>
                  <td height="30"><div align="right">验证码:</div></td>
                  <td height="25" nowrap background="images/bg_pa1.gif">&nbsp;&nbsp;&nbsp;<input type=text name="Verifycode" maxLength=6 size="6" tabindex="3" class="login1">&nbsp;<IMG style="cursor:hand;" src="../inc/verifycode.asp" onClick="this.src=this.src;" align="absmiddle">&nbsp;</td>
                </tr>
                <tr>
                  <td colspan="4"></td>
                </tr>
              </table></td>
              <td width="7" align="center" valign="middle" bgcolor="#195D92"></td>
            </tr>
            <tr bgcolor="F7E4D6">
              <td height="6" colspan="3" valign="bottom" bordercolor="#FFFFFF" bgcolor="#195D92"><img src="images/1-4.gif" width="6" height="6"></td>
              </tr>
          </table></TD>
        </TR>
        
        <TR vAlign=bottom align=middle>
          <TD vAlign=center width=198 height=90>
            <P align=right>
            <SCRIPT language=JavaScript type=text/JavaScript>
				nereidFadeObjects = new Object();
				nereidFadeTimers = new Object();
				function nereidFade(object, destOp, rate, delta){
				if (!document.all)
				return
					if (object != "[object]"){ 
						setTimeout("nereidFade("+object+","+destOp+","+rate+","+delta+")",0);
						return;
					}
					clearTimeout(nereidFadeTimers[object.sourceIndex]);
					diff = destOp-object.filters.alpha.opacity;
					direction = 1;
					if (object.filters.alpha.opacity > destOp){
						direction = -1;
					}
					delta=Math.min(direction*diff,delta);
					object.filters.alpha.opacity+=direction*delta;
					if (object.filters.alpha.opacity != destOp){
						nereidFadeObjects[object.sourceIndex]=object;
						nereidFadeTimers[object.sourceIndex]=setTimeout("nereidFade(nereidFadeObjects["+object.sourceIndex+"],"+destOp+","+rate+","+delta+")",rate);
					}
				}
				</SCRIPT>
            <A href="javascript:window.close()" target=_parent><IMG onmouseover=nereidFade(this,100,10,5)  style="FILTER:alpha(opacity=30)" onmouseout=nereidFade(this,30,10,5) src="Images/login1.gif"  border=0></A></P>			</TD>
          <TD vAlign=center width=307 height=90>
            <P align=left>&nbsp;<FONT color=#ffffff>取消登入,关闭此窗口!</FONT></P></TD>
          <TD width=320 height=90 align="right" vAlign=center><FONT 
            color=#ffffff>登入后,可以修改或添加新的管理员!</FONT></TD>
          <TD vAlign=center width=153 height=90>
            <P align=left><A href="http://bbs.kesion.com" target=_blank><IMG onmouseover=nereidFade(this,100,10,5)  style="FILTER: alpha(opacity=30)" onmouseout=nereidFade(this,30,10,5) src="Images/tophelp.gif" border=0></A></P></TD></TR></TBODY></TABLE>
      </DIV></FORM></TD></TR></TBODY>
			</TABLE>
		</DIV>
		</CENTER>
	</BODY>
</HTML>
<script language=javascript>
<!--
function document.onreadystatechange()
{  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 或以上版本。');
  }
  document.LoginForm.UserName.focus();
}
function CheckForm(ObjForm) {
  if(ObjForm.UserName.value == '') {
    alert('请输入管理账号!');
    ObjForm.UserName.focus();
    return false;
  }
  if(ObjForm.PWD.value == '') {
    alert('请输入授权密码!');
    ObjForm.PWD.focus();
    return false;
  }
  if (ObjForm.PWD.value.length<6)
  {
    alert('授权密码不能少于六位!');
    ObjForm.PWD.focus();
    return false;
  }
  if (ObjForm.Verifycode.value == '') {
    alert ('请输入验证码!');
    ObjForm.Verifycode.focus();
    return false;
  }
  <%if EnableSiteManageCode = True Then%>
  if (ObjForm.AdminLoginCode.value == '') {
    alert ('请输入后台管理认证码!');
    ObjForm.AdminLoginCode.focus();
    return false;
  }
  <%End If%>
}
//-->
</script>
</html>
<%End Sub
Sub CheckLogin()
  Dim PWD,UserName,LoginRS,SqlStr
  Dim GroupRS,LastLoginIP,ScriptName,AdminLoginCode
  AdminLoginCode=KSCMS.G("AdminLoginCode")
  IF Trim(Request.Form("Verifycode"))<>Trim(Session("Verifycode")) then 
   Call KSCMS.Alert("登录失败:\n\n验证码有误,请重新输入!","Login.asp")
   exit Sub
  end if
  If EnableSiteManageCode = True And AdminLoginCode <> SiteManageCode Then
   Call KSCMS.Alert("登录失败:\n\n您输入的后台管理认证码不对,请重新输入!","Login.asp")
   exit Sub
  End If
 Pwd =KSCMS.MD5(KSCMS.ReplaceBadChar(Request.form("pwd")),16)

  UserName = KSCMS.ReplaceBadChar(trim(Request.form("username")))
  ScriptName=Trim(Request.ServerVariables("HTTP_REFERER"))
  LastLoginIP = Trim(Request.ServerVariables("HTTP_X_FORWARDED_FOR"))
  If LastLoginIP = "" Then LastLoginIP = Request.ServerVariables("REMOTE_ADDR")
  
  Set LoginRS = Server.CreateObject("ADODB.RecordSet")
  SqlStr = "select * from KS_Admin where UserName='" & UserName & "'"
  LoginRS.Open SqlStr,Conn,1,3
  If LoginRS.EOF AND LoginRS.BOF Then
	  Call KSCMS.InsertLog(UserName,0,ScriptName,"输入了错误的帐号!")
      Call KSCMS.AlertHistory("登录失败:\n\n您输入了错误的帐号,请再次输入!",-1)
  Else
  
     IF LoginRS("PassWord")=pwd THEN
       IF Cint(LoginRS("Locked"))=1 Then
          Call KSCMS.Alert("登录失败:\n\n您的账号已被管理员锁定,请与您的系统管理员联系!","Login.asp")	
	      Response.End
	   Else
	     Set GroupRS=Server.CreateObject("AdoDb.RecordSet")
	      GroupRS.Open "Select * From KS_AdminGroup Where GroupID=" & LoginRS("GroupID"),Conn,1,1
	     IF  GroupRS.Eof And GroupRS.Bof Then
		   Call KSCMS.InsertLog(UserName,0,ScriptName,"所在的管理组已被删除!")
           Call KSCMS.Alert("登录失败:\n\n您所在的管理组已被删除,请与系统管理员联系!","Login.asp")	
	       Response.End
	      Else
		  	 '登录成功,进行前台验证,并更新数据
			  Dim UserRS:Set UserRS=Server.CreateObject("Adodb.Recordset")
			  UserRS.Open "Select Score,LastLoginIP,LastLoginTime,LoginTimes,UserName,Password From KS_User Where UserName='" & LoginRS("PrUserName") & "' and GroupID=4",Conn,1,3
			  IF Not UserRS.Eof Then
					 UserRS("Score")=UserRS("Score")+KSCMS.GetConfig("LoginPerTimeAddScore")
					 UserRS("LastLoginIP") = LastLoginIP
					 UserRS("LastLoginTime") = Now()
					 UserRS("LoginTimes") = UserRS("LoginTimes") + 1
					 UserRS.Update			
			        
					'置前台会员登录状态
					 Response.Cookies(KSCMS.SiteSn)("UserName") = KSCMS.ReplaceBadChar(UserRS("UserName"))
			         Response.Cookies(KSCMS.SiteSn)("Password") = UserRS("Password")
					
					  ' Session.Timeout=KSCMS.GetConfig("SessionTimeout")
					   Response.Cookies(KSCMS.SiteSn)("AdminLoginCode") = AdminLoginCode
					   Response.Cookies(KSCMS.SiteSn)("AdminName") =  LoginRS("UserName")
					   Response.Cookies(KSCMS.SiteSn)("AdminPass")=LoginRS("Password")
					   Response.Cookies(KSCMS.SiteSn)("SuperTF")     =GroupRS("SuperTF")
					   Response.Cookies(KSCMS.SiteSn)("PowerList")   =GroupRS("PowerList")
					   Response.Cookies(KSCMS.SiteSn)("ArticlePower")=GroupRS("ArticlePower")
					   Response.Cookies(KSCMS.SiteSn)("PicturePower")=GroupRS("PicturePower")
					   Response.Cookies(KSCMS.SiteSn)("DownLoadPower")=GroupRS("DownLoadPower")
					   Response.Cookies(KSCMS.SiteSn)("FlashPower")=GroupRS("FlashPower")
             Else 
				   Call KSCMS.InsertLog(UserName,0,ScriptName,"找不到前台账号!")
				   Call KSCMS.Alert("登录失败:\n\n找不到前台账号!","Login.asp")	
				   Response.End
			 End If
			   UserRS.Close:Set UserRS=Nothing
			   
	      End IF	  
	  LoginRS("LastLoginTime")=Now
	  LoginRS("LastLoginIP")=LastLoginIP
	  LoginRS("LoginTimes")=LoginRS("LoginTimes")+1
	  LoginRS.UpDate
	  GroupRS.Close:Set GroupRS=Nothing
	  Call KSCMS.InsertLog(UserName,1,ScriptName,"成功登录后台系统!")
	  Response.Redirect("Admin_Index.asp")
	End IF
  ELse
        Response.Cookies(KSCMS.SiteSn)("AdminName")=""
	Response.Cookies(KSCMS.SiteSn)("AdminPass")=""
	Response.Cookies(KSCMS.SiteSn)("SuperTF")=""
	Response.Cookies(KSCMS.SiteSn)("PowerList")=""
	Response.Cookies(KSCMS.SiteSn)("ArticlePower")=""
	Response.Cookies(KSCMS.SiteSn)("PicturePower")=""
        Response.Cookies(KSCMS.SiteSn)("DownLoadPower")=""
	Response.Cookies(KSCMS.SiteSn)("FlashPower")=""
	Call KSCMS.InsertLog(UserName,0,ScriptName,"输入了错误的口令:" & Request.form("pwd"))
    Call KSCMS.Alert("登录失败:\n\n您输入了错误的口令,请再次输入!","Login.asp")	
  END IF
 End If
END Sub
Set KSCMS=Nothing
%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -