<?php
|
include_once "/Common/Logging.php";
|
include_once "/Account/User.php";
|
include_once "/db/DBOper.php";
|
include_once "/Common/CommFunc.php";
|
include_once "/language/lang.php";
|
|
function DoLogin()
|
{
|
global $msg;
|
global $UserAccount;
|
|
$UserAccount = $_POST['UserAccount'];
|
$Psw = $_POST['Psw'];
|
|
if (!\DBOper\FindOne("GMTUser", array("UserAccount" => $UserAccount), $userData)) {
|
\Logging\LogError("查找db异常");
|
$msg = \Lang\gettext("服务器错误");
|
return;
|
}
|
|
if (!isset($userData)) {
|
\Logging\LogError("账号不存在!");
|
$msg = \Lang\gettext("账号不存在");
|
return;
|
}
|
|
$db_pw = $userData["Psw"];
|
$Psw = \Commfunc\GetEncodePsw($Psw);
|
if (!$Psw || $Psw != $db_pw) {
|
\Logging\LogError("账号密码错误!");
|
$msg = \Lang\gettext("账号密码错误");
|
return;
|
}
|
|
if (!\DBOper\Update(
|
"GMTUser",
|
array("UserAccount" => $UserAccount),
|
array(
|
"LoginTime" => date("Y-m-d H:i:s"),
|
"IP" => \CommFunc\GetIP()
|
),
|
true
|
)) {
|
\Logging\LogError("更新db异常");
|
$msg = \Lang\gettext("服务器错误");
|
return;
|
}
|
|
\CommFunc\SessionSave(array('UserAccount' => $UserAccount));
|
\Logging\LogInfo("登录成功:" . $UserAccount);
|
// header("Location:/index.php");
|
header("location:/Account/Server/SelectServer.php");
|
}
|
|
\Logging\CreateLogging("account.login.php");
|
\Logging\LogInfo("_POST: " . print_r($_POST, true));
|
|
$msg = "";
|
$UserAccount = "";
|
// 重置已登录的账号
|
\CommFunc\SessionSave(array('UserAccount' => "", 'spid' => "", 'server_id' => "", 'tool_page' => ""));
|
|
if (array_key_exists('UserAccount', $_POST)) {
|
DoLogin();
|
} else {
|
if (\DBOper\FindOne("GMTUser", array("UserLV" => \User\UserLV::ADMIN_SUPER), $userData) && !isset($userData)) {
|
header("location:/Account/super.php");
|
exit;
|
}
|
if ($_GET["superok"] == "1") {
|
$msg = "超级管理员创建成功,请登录!";
|
} else if ($_GET["superok"] == "2") {
|
$msg = "超级管理员已经存在,请登录!";
|
}
|
}
|
|
if ($msg) {
|
echo "<script>alert('" . $msg . "')</script>";
|
}
|
|
?>
|
|
<html>
|
|
<head>
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
<title><?php echo \Lang\gettext("GM工具账号登录"); ?></title>
|
</head>
|
|
<body>
|
|
<div class="divForm">
|
<form id="userLogin" name="userLogin" action="login.php" method="post">
|
|
<b><?php echo \Lang\gettext("GM工具账号登录"); ?></b><br /><br />
|
|
<?php echo \Lang\gettext("账号"); ?>: <input class="long_input" type="text" name="UserAccount" value="<?php echo $UserAccount; ?>" /><br /><br />
|
|
<?php echo \Lang\gettext("密码"); ?>: <input class="long_input" type="password" name="Psw" /><br /><br />
|
|
<input type="submit" name="submit" value="<?php echo \Lang\gettext("登录"); ?>" />
|
<br /><br />
|
<?php \Lang\showSelectLang(); ?>
|
<br /><br />
|
|
</form>
|
</div>
|
</body>
|
|
<style type="text/css">
|
.divForm {
|
position: absolute;
|
width: 300px;
|
height: 200px;
|
text-align: center;
|
top: 50%;
|
left: 50%;
|
margin-top: -200px;
|
margin-left: -150px;
|
}
|
</style>
|
|
</html>
|