hxp
2025-06-04 f4a514d5ac952110da846636ecbb9de951eaf3d2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
<?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>