forked from hieulw/manager
-
Notifications
You must be signed in to change notification settings - Fork 0
/
login.php
73 lines (56 loc) · 2.79 KB
/
login.php
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
<?php
define('ACCESS', true);
define('LOGIN', true);
include_once 'function.php';
if (IS_LOGIN) {
goURL('index.php');
} else {
$title = 'Đăng nhập';
$notice = null;
if (isset($_POST['submit'])) {
$notice = '<div class="notice_failure">';
$username = addslashes($_POST['username']);
$password = addslashes($_POST['password']);
if ($username == null || $password == null) {
$notice .= 'Chưa nhập đầy đủ thông tin';
} else if (strtolower($username) != strtolower($configs['username']) || getPasswordEncode($password) != $configs['password']) {
$notice .= 'Sai tài khoản hoặc mật khẩu';
} else {
$_SESSION[SESS] = true;
goURL('index.php');
}
$notice .= '</div>';
}
include_once 'header.php';
if (IS_INSTALL_ROOT_DIRECTORY) {
echo '<div class="title">Lỗi File Manager</div>
<div class="list">Bạn đang cài đặt File Manager trên thư mục gốc, hãy chuyển vào một thư mục. Bạn có thể đăng nhập nhưng tất cả các chức năng đều bị ẩn và chặn</div>';
}
echo '<div class="title">' . $title . '</div>';
echo $notice;
if (IS_CONFIG_UPDATE || IS_CONFIG_ERROR)
@unlink(REALPATH . '/' . PATH_CONFIG);
if (IS_CONFIG_UPDATE)
echo '<div class="notice_info">Cấu hình cập nhật sẽ đưa về mặc định</div>';
else if (IS_CONFIG_ERROR)
echo '<div class="notice_failure">Cấu hình bị lỗi sẽ đưa về mặc định</div>';
else if (!is_file(REALPATH . '/' . PATH_CONFIG))
echo '<div class="notice_info">Cấu hình không tồn tại nó sẽ được tạo</div>';
if (!is_file(REALPATH . '/' . PATH_CONFIG)) {
if (createConfig())
echo '<div class="notice_info">Tài khoản: <strong>' . LOGIN_USERNAME_DEFAULT . '</strong>, Mật khẩu: <strong>' . LOGIN_PASSWORD_DEFAULT . '</strong></div>';
else
echo '<div class="notice_failure">Tạo cấu hình thất bại, hãy thử lại</div>';
}
echo '<div class="list">
<form action="login.php" method="post">
<span class="bull">•</span>Tên đăng nhập:<br/>
<input type="text" name="username" value="" size="18"/><br/>
<span class="bull">•</span>Mật khẩu:<br/>
<input type="password" name="password" value="" size="18"/><br/>
<input type="submit" name="submit" value="Đăng nhập"/>
</form>
</div>';
include_once 'footer.php';
}
?>