<!--#include file="QvodCms_Conn.asp"-->
<%
Action = Trim(Request("Action"))
SiteManageCode=Config(7) '管理认证码
If Action = "Login" Then
    Call ChkLogin
ElseIf Action = "Logout" Then
    Call Logout
Else
    Call main
End If

Sub ChkLogin()
    On Error Resume Next
    Dim sql, rs
    Dim UserName, Password, CheckCode, RndPassword, AdminLoginCode,LoginCode
    UserName = ReplaceBadChar(Trim(Request.Form("UserName")))
    Password = ReplaceBadChar(Trim(Request.Form("Password")))
    CheckCode = LCase(ReplaceBadChar(Trim(Request.Form("CheckCode"))))
	LoginCode = ReplaceBadChar(Trim(Request.Form("LoginCode")))
    AdminLoginCode =Trim(Config(7))' Trim(Request("AdminLoginCode"))

    If CSng(ScriptEngineMajorVersion & "." & ScriptEngineMinorVersion) < 5.6 Then
	    Call QvodCms_Err("服务器脚本解释引擎（VBScript）版本过低，请联系您的空间商或服务器管理员更新。")
		Exit Sub
    End If

    If UserName = "" Then
		Call QvodCms_Err("用户名不能为空！")
		Exit Sub
    End If
    If Password = "" Then
		Call QvodCms_Err("密码不能为空！")
		Exit Sub
    End If
	If LoginCode = "" Then
		Call QvodCms_Err("认证码不能为空！")
		Exit Sub
    End If
    If CheckCode = "" Then
		Call QvodCms_Err("验证码不能为空！")
		Exit Sub
    End If
    If Trim(Session("CheckCode")) = "" Then
		Call QvodCms_Err("你在管理登录停留的时间过长，导致验证码失效。请重新返回登录页面进行登录。")
		Exit Sub
    End If
    If CheckCode <> Session("CheckCode") Then
	    Call QvodCms_Err("您输入的验证码和系统产生的不一致，请重新输入。")
		Exit Sub
    End If
	If LoginCode<>AdminLoginCode Then
	    Call QvodCms_Err("您输入的认证码错误，请重新输入。")
		Exit Sub
    End If		
    Password = MD5(Password, 16)
	Call OpenConn()
    Set rs = Server.CreateObject("adodb.recordset")
    sql = "select * from qvodcms_admin where admin_pass='" & Password & "' and admin_name='" & UserName & "'"
    rs.Open sql, Conn, 1, 3
    If rs.bof And rs.EOF Then
        FoundErr = True
        Call QvodCms_Err("用户名或密码错误！！！")
    Else
        If Password <> rs("admin_pass") Then
            FoundErr = True
			Call QvodCms_Err("用户名或密码错误！！！")
        End If
    End If
	
    If FoundErr = True Then
        'Call InsertLog(1, -1, UserName, UserTrueIP, "登录失败", ComeUrl, "")
        Session("AdminName") = ""
        Session("AdminPassword") = ""
        Session("RndPassword") = ""
        rs.Close
        Set rs = Nothing
        Exit Sub
    End If
    UserName = rs("admin_name")
    RndPassword = GetRndPassword(16)
    rs("LastLoginIP") = QvodCms_Ip() '登录IP
	rs("LastLoginTime") = Now() '登录时间
	rs("RndPassword") = RndPassword '随机验证码
    rs.Update:QvodCmsError()
    'Call InsertLog(1, 0, UserName, UserTrueIP, "登录成功", ComeUrl, "")

    strInstallDir = GetScriptPath(Trim(Request.ServerVariables("SCRIPT_NAME")), 1)
    Site_Sn = Replace(Replace(LCase(Request.ServerVariables("SERVER_NAME") & strInstallDir), "/", ""), ".", "")
    Response.Cookies(Site_Sn)("AdminName") = rs("admin_name")
    Response.Cookies(Site_Sn)("AdminPassword") = rs("admin_pass")
    Response.Cookies(Site_Sn)("RndPassword") = RndPassword
    Response.Cookies(Site_Sn)("AdminLoginCode") = AdminLoginCode
	Session("QvodCms")="qvodcms.com"
    rs.Close

    Call CloseConn
    Response.Redirect "index.asp"
End Sub

Sub Logout()
    strInstallDir = GetScriptPath(Trim(Request.ServerVariables("SCRIPT_NAME")), 1)
    Site_Sn = Replace(Replace(LCase(Request.ServerVariables("SERVER_NAME") & strInstallDir), "/", ""), ".", "")
    Response.Cookies(Site_Sn)("AdminName") = ""
    Response.Cookies(Site_Sn)("AdminPassword") = ""
	Session("QvodCms")=""
    Call CloseConn
	Call QvodCms_Err_Url("成功退出QVODCMS点播专家！！！","../index.asp")
End Sub

%>
<%
Sub main
Dim JaJaLogin
JaJaLogin=Request.ServerVariables("url")
JaJaLogin=LCase(JaJaLogin)
If InStr(JaJaLogin,"/admin/")>0 Then 
AC="readonly"
Response.Write "<h3>对不起，您的后台目录名admin不安全，请使用FTP工具进行重命名修改后登陆</h3>"
Response.End()
End If
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title><%=Config(8)%>-管理员登录</title>
<meta name="generator" content="QvodCms" />
<meta http-equiv="X-UA-Compatible" content="IE=7" /> 
<meta name="MSSmartTagsPreventParsing" content="TRUE" />
<meta http-equiv="MSThemeCompatible" content="Yes" />
<link rel="SHORTCUT ICON" href="favicon.ico" />
<link rel="stylesheet" type="text/css" href="skins/aspsky_1.css" />
<script language = "javaScript" src = "inc/Main.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript">var boardxml='',ISAPI_ReWrite = 0,forum_picurl='skins/Default/';</script><!--QvodCms管理后台CSS样式表--> 
<style type="text/css">
<!--
body ,th,td{ font-size:12px; color:#3b6d90; font-family:Arial, Helvetica, sans-serif}
body  { margin:0px; background:#1675b7; margin:0px; padding:10px; SCROLLBAR-FACE-COLOR: #37b2e9; SCROLLBAR-HIGHLIGHT-COLOR: #1d90cd; SCROLLBAR-SHADOW-COLOR: #1d90cd; SCROLLBAR-DARKSHADOW-COLOR: #1d90cd; SCROLLBAR-3DLIGHT-COLOR: #1d90cd; SCROLLBAR-ARROW-COLOR: #eef7fb;SCROLLBAR-TRACK-COLOR: #1d90cd; }
.inp{ width:130px; height:22px; border:1px #97bcd7 solid; color:#065a92}
.button{ background:url(Skins/images/logona.gif) no-repeat; border:0px; width:68px; height:28px; margin-top:5px;}
#popmenu{ margin-top:-25px;}
-->
</style>
</head>
<body onLoad="if(window.name!=''){document.body.style.width='100%';}">
<div class="menuskin" id="popmenu" style="z-index:100;">
<table width="837" height="549" border="0" align="center" cellpadding="0" cellspacing="0" id="__01">
<tr>
		<td colspan="3">
			<img src="Skins/images/qvodcms_01.gif" width="837" height="72" alt=""></td>
	</tr>
	<tr>
		<td colspan="3">
			<img src="Skins/images/qvodcms_02.gif" width="837" height="95" alt=""></td>
	</tr>
	<tr>
		<td rowspan="2">
			<img src="Skins/images/qvodcms_03.gif" width="134" height="382" alt=""></td>
		<td background="Skins/images/qvodcms_04.gif">
        
        
        <table width="236" height="157" border="0" align="center" cellpadding="0" cellspacing="0">
        <form name='Login' action='qvodcms_login.asp?action=Login' method='post' target='_parent' onSubmit='return CheckForm();'>
          <tr>
            <td width="55" height="25"><strong>用户名：</strong></td>
            <td width="181"><input name='UserName' class="inp" type='text' maxLength='20' id='UserName' /></td>
          </tr>
          <tr>
            <td height="25"><strong>密　码：</strong></td>
            <td><input name='password' class="inp"  type='password' maxLength='20'  /></td>
          </tr>
          <tr>
            <td height="25"><strong>认证码：</strong></td>
            <td><input name='LoginCode' class="inp" type='password' maxLength='20'/></td>
          </tr>
          <tr>
            <td height="25"><strong>验证码：</strong></td>
            <td><input name='CheckCode' class="inp" maxlength='6' type="text"/>&nbsp;<img id='checkcode' src='../Include/QvodCms.CheckCode.asp' onClick="this.src='../Include/QvodCms.CheckCode.asp?'+Math.random();" style='border: 1px solid #ffffff;cursor:hand; ' /><span onClick="CheckCodeImg.src='../Include/QvodCms.CheckCode.asp?'+Math.random();" style="cursor:hand;" alt="看不清,我要换一个"></span></td>
          </tr>
          <tr>
            <td height="57" colspan="2" valign="top"><table width="77%" border="0" align="right" cellpadding="0" cellspacing="0">
              <tr>
                <td width="41%" height="43"><input  class="button" type="image" src="Skins/images/login.gif" name='Submit' value="登 录"/></td>
                <td width="59%"><input  class="button" type="reset" name="submit2" value=""/></td>
              </tr>
            </table></td>
          </tr></form>
        </table>
        
        </td>
<td>
			<img src="Skins/images/qvodcms_05.gif" width="152" height="318" alt=""></td>
	</tr>
	<tr>
		<td width="551" height="61" background="Skins/images/qvodcms_06.gif"><table width="104%" height="21" border="0" cellpadding="0" cellspacing="0">
          <tr>
            <td  align="center" style="padding-top:14px; color:#005f9c">Copyright Right &copy;2008 QvodCms.Com Version <%=veision%></td>
          </tr>
        </table></td>
<td>
			<img src="Skins/images/qvodcms_07.gif" width="152" height="64" alt=""></td>
	</tr>
</table>
</div>
<script language=javascript>
<!--
var closestr=0;
function SetFocus() {
if(document.Login.UserName.value == '')
  document.Login.UserName.focus();
else
  document.Login.UserName.select();
}
function CheckForm() {
  if(document.Login.UserName.value == '') {
    alert('请输入用户名！');
    document.Login.UserName.focus();
    return false;
  }
  if(document.Login.password.value == '') {
    alert('请输入密码！');
    document.Login.password.focus();
    return false;
  }
  if (document.Login.LoginCode.value == '') {
    alert ('请输入您的认证码！');
    document.Login.LoginCode.focus();
    return(false);
  }
  if (document.Login.CheckCode.value == '') {
    alert ('请输入您的验证码！');
    document.Login.CheckCode.focus();
    return(false);
  }
}
function CheckBrowser() {
  var app=navigator.appName;
  var verStr=navigator.appVersion;
  if(app.indexOf('Netscape') != -1) {
    alert('友情提示：\n    你使用的是Netscape、Firefox或者其他非IE浏览器，可能会导致无法使用后台的部分功能。建议您使用 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 或以上版本。');
  }
}
function refreshimg(){document.all.checkcode.src='../Include/QvodCms.CheckCode.asp';}
//-->
</script>
<script language='JavaScript' type='text/JavaScript'>CheckBrowser();SetFocus();</script>
</body>
</html>
<%End Sub%>