<%@ Language="VBScript" %>
<% option explicit %>
<!-- #include file="inc/dbconn.inc.asp" //-->
<%
'正在登录的用户 ========================================
dim strErrMsg
dim LOGINUSER,LOGINRIGHT,LOGINPROPAGATEGET,LOGINPROPAGATEPOST,userName,userPass,CanDoThisAction,onLoadStr,subaction

action = Request("action")
subaction = Request("subaction")
LOGINID = Request("LOGINID")
if action = "login" then
	LOGINUSER = 0
	LOGINID = ""
	userName = trim(Request("name"))
	userPass = trim(Request("pass"))
	
	sql = "SELECT id,pass,myright FROM bg_adminUser WHERE name='"& userName &"'"
	rs.CursorLocation = 3
	rs.open sql, conn, 1, 1
	if not rs.EOF then		
		if rs("pass") = md5(userPass) then
			LOGINUSER = rs("id")
			LOGINID = md5(rs("pass")& Request.ServerVariables("REMOTE_ADDR") & timer())
			LOGINRIGHT = rs("myright")
			action = "welcome"
			conn.Execute("INSERT INTO bg_sessions(sesskey,IP,memberid,sdate,logtype) values('"& LOGINID &"','"& Request.ServerVariables("REMOTE_ADDR") &"',"& rs("id") &","& timer() &",'a')")
			Response.Redirect "main.asp?LOGINID="& LOGINID
		else
			strErrMsg = "口令错误，请重新登录！"
		end if
	else
		strErrMsg = "帐号不存在，请重新登录！"
	end if
	rs.Close
end if
%>
<html>
<head>
  <title>后台管理系统</title>
  <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  <link rel="stylesheet" href="Common/main.css">

</head>

<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" border="0" height="100%">
  <tr>
    <td align="center" valign="middle">
      <table width="753" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td><img src="images/indexTop.gif" width="753" height="70"></td>
        </tr>
        <tr>
          <td><img src="images/indexRectTop.gif" width="753" height="23"></td>
        </tr>
        <tr>
          <td background="images/indexRectBg.gif" align="center" height="94">
            <table width="95%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td height="43">
                  亲爱的同事，你好：<br>
                  　　欢迎登录后台管理系统，本系统只对内部员工开放，如果是第一次使用，请向管理员获取帐号及密码。谢谢！<br>
                  <font color="RED"><%=strErrMsg%></font>
                </td>
              </tr>
            </table>
          </td>
        </tr>
        <tr>
          <td background="images/indexRectBg.gif" align="right">
            <table border="0" cellspacing="0" cellpadding="0" width="336">
              <tr>
                <td width="287" height="39"><img src="images/indexLoginTop.gif" width="287" height="39"></td>
                <td>&nbsp;</td>
              </tr>
              <tr>
                <td background="images/indexLoginBg.gif" height="102" align="right">
                  <table width="179" border="0" cellspacing="0" cellpadding="0">
                  <form name="login" action="index.asp" method="post">
                  <input type="hidden" name="action" value="login">
                    <tr>
                      <td width="61" height="26">登录帐号：</td>
                      <td width="106" height="26">
                        <input type="text" name="name" value="" size="13" class="ButtonEdit">
                      </td>
                      <td width="12" height="27">&nbsp;</td>
                    </tr>
                    <tr>
                      <td width="61" height="26">登录密码：</td>
                      <td width="106" height="26">
                        <input type="password" name="pass" size="13" class="ButtonEdit">
                      </td>
                      <td width="12" height="26">&nbsp;</td>
                    </tr>
                    <tr>
                      <td colspan="2" height="39">
                        <input type="image" src="images/indexLogin.gif" width="71" height="19">
                        <img src="images/indexReg.gif" width="71" height="19">
                      </td>
                      <td width="12" height="39">&nbsp;</td>
                    </tr>
                  </form>
                  </table>
                </td>
                <td height="102">&nbsp;</td>
              </tr>
            </table>
          </td>
        </tr>
        <tr>
          <td><img src="images/indexBottom.gif" width="753" height="59"></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
</body>
</html>