<?php

// +---------------------------------------------+
// |     Copyright  2008 - 2018 weenCompany      |
// |     http://www.weentech.com                 |
// |     This file may not be redistributed.     |
// +---------------------------------------------+

if(@file_exists('../install'))
{
	error_reporting(E_ALL & ~E_NOTICE);
	$needDeleteInstall = 1;
	LogIn();
}


if(isset($_GET['lang']) AND (!isset($_COOKIE['weenCompany_mplang']) OR $_COOKIE['weenCompany_mplang'] != $_GET['lang']))
{
    $lang = strtolower($_GET['lang']);
	if($lang == 'cn' OR $lang == 'en'){
		setcookie("weenCompany_mplang", $lang, 0, "/");
		Header("Location: $_SERVER[REQUEST_URI]");
		exit();
	}
}
 
define('IN_ADMIN', true);
define('IN_WEENCOMPANY', true);
define('ADMIN_LOGIN', true);
define('MOD_ACCESS', true);

$rootpath = "./../";

include($rootpath . 'includes/core.php');

SetPageCharacterSet();

function LogIn()
{
	global $needDeleteInstall, $logininfo, $sitedefaultlang;
	if($needDeleteInstall)
	{
	  $logininfo ='提示: 请在删除系统安装目录(./install/)后继续!';
	  $disabled =  ' disabled="disabled" style="cursor:default;"';
	}else{
	  $inputfocus = 'onLoad="document.forms.wcloginform.loginusername.focus()"';
	  $logintocn = 'index.php?lang=cn';
	  $logintoen = 'index.php?lang=en';
	}
	

  echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
        <html>
        <head>

		<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
        <title>weenCompany闻名企业网站系统(CWS)管理登录</title>
        <link rel=stylesheet href=\'./styles/advanced/login.css\' />
        <SCRIPT LANGUAGE="JAVASCRIPT" TYPE="TEXT/JAVASCRIPT">
        <!--
        if(top.location != self.location)
        {
          top.location.replace(self.location)
        }
        -->
        </SCRIPT>

        </head>

        <body id="page-login" '. $inputfocus .' >
		
		<div class="login-container">
        <div class="login-box">
            <form action="index.php" method="post" name="wcloginform">
                <fieldset class="login-form">
                    <h2>weenCompany闻名企业网站系统 - 管理登录</h2>
                    <div id="messages">' . $logininfo . '</div>
                    <div class="input-box input-left"><label for="username">用户名:</label><br/>
                        <input type="text" id="username" name="loginusername" value="" class="required-entry input-text" '.$disabled .'/></div>
                    <div class="input-box input-right"><label for="login">密码:</label><br/>
                        <input type="password" id="login" name="loginpassword" class="required-entry input-text" value="" '.$disabled .'/></div>
                    <div class="clear"></div>
                    <div class="form-buttons" style="margin-right:8px;"><input type="submit" class="form-button" value="登 录" '.$disabled .'/></div>
                     <div style="margin-left:8px;">';
						if($sitedefaultlang == 'en') 
						{
							echo '<a href="'.$logintocn.'" target="_parent" class="normal">登录中文</a>';
						}
						else
						{
							echo '<a href="'.$logintoen.'" target="_parent" class="normal">登录English</a>';
						}
			echo '<a href="forgotpass.php" target="_parent" class="normal" style="padding-left:28px;">找回密码?</a>&nbsp;</div>
               </fieldset>
                <p class="legal" align="right"><a href="http://www.weentech.com" target="_blank" class="normal">闻泰网络</a> <font color=#FF9900>&copy;</font><font class="copyright">'.date("Y").'</font>&nbsp;</p>
            </form>
            <div class="bottom"></div>
        </div>
		</div>
	</body>
    </html>';

  exit();
}

echo '<html>
      <head>
      <SCRIPT LANGUAGE="JAVASCRIPT" TYPE="TEXT/JAVASCRIPT">
      <!--
      if(top.location != self.location)
      {
        top.location.replace(self.location)
      }
      -->
      </SCRIPT>

      <title>weenCompany闻名企业网站系统(CWS)</title>
      </head>

      <frameset cols="185,*" framespacing="0" border="0" frameborder="0" frameborder="no">
        <frame src="menu.php" name="leftFrame" scrolling="yes" frameborder="0" border="no" />
		<frame src="mphome.php" name="mainFrame" scrolling="YES" />
	  </frameset>

      <noframes>
        <body>对不起，您的浏览器不支持框架，程序无法运行！</body>
      </noframes>
      </html>';

?>