-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
142 lines (125 loc) · 5.13 KB
/
index.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
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
<?php
error_reporting(E_ALL);
session_start();
require_once("includes/dbconnect.php"); //Load the settings
require_once("includes/functions.php"); //Load the functions
require_once("includes/languages.php"); //Load the langs
$msg="";
//LOGIN VARIABLES
$username = (!empty($_REQUEST['username']))?strip_tags(str_replace("'","`",$_REQUEST['username'])):'';
$password = (!empty($_REQUEST['password']))?strip_tags(str_replace("'","`",$_REQUEST['password'])):'';
// LOGIN
if(!empty($_REQUEST["login"]) && $_REQUEST['login']=="yes"){
if($username=="" || $password=="")
{
$msg = '<div class="alert alert-warning alert-dismissible">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<h5><i class="icon fas fa-exclamation-triangle"></i> '.$lang['ALERT'].'</h5>
'.$lang['WRONG_LOGIN'].'
</div>';
} else {
$sSQL = "SELECT * FROM `adm_settings` WHERE `username`='".$username."'";
$result = mysqli_query($mysqli,$sSQL) or die("Invalid query: " . mysqli_error($mysqli));
if(mysqli_num_rows($result)>0){
$row=mysqli_fetch_assoc($result);
if(md5($password)!=$row["password"]){
$msg = '<div class="alert alert-warning alert-dismissible">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<h5><i class="icon fas fa-exclamation-triangle"></i> '.$lang['ALERT'].'</h5>
'.$lang['WRONG_LOGIN'].'
</div>';
} else {
$_SESSION['idUser']= $row["id"];
$_SESSION['username']= $row["username"];
$_SESSION['accesslevel']= 1899;
$_SESSION['logged_in'] = true;
}
} else {
$msg = '<div class="alert alert-warning alert-dismissible">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<h5><i class="icon fas fa-exclamation-triangle"></i> '.$lang['ALERT'].'</h5>
'.$lang['WRONG_LOGIN'].'
</div>';
}
}
}
if(isset($_SESSION["logged_in"]) && $_SESSION["logged_in"]==true){
header("Location: dashboard.php");
} else {
?>
<!DOCTYPE html>
<html lang="<?php echo $lang['LANG_CODE']; ?>">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Log in | <?php echo $lang['SITE_TITLE']; ?></title>
<link rel="icon" type="image/png" sizes="96x96" href="assets/img/domain.png">
<!-- Google Font: Source Sans Pro -->
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700&display=fallback">
<!-- Font Awesome -->
<link rel="stylesheet" href="assets/js/fontawesome-free/css/all.min.css">
<!-- icheck bootstrap -->
<link rel="stylesheet" href="assets/js/icheck-bootstrap/icheck-bootstrap.min.css">
<!-- Theme style -->
<link rel="stylesheet" href="assets/css/adminlte.min.css">
<link rel="stylesheet" href="assets/css/custome.css">
</head>
<body class="hold-transition login-page">
<div class="login-box">
<div class="login-logo">
<img src="assets/img/domain.png" alt="Logo" class="brand-image" style="width:48px;"> <b style="color:#1E81CE;"><?php echo $lang['SITE_TITLE']; ?></b>
</div>
<!-- /.login-logo -->
<div class="card">
<div class="card-body login-card-body">
<?php echo $msg; ?>
<p class="login-box-msg"><?php echo $lang['SIGNIN_TO_START']; ?></p>
<form method="post" action="index.php" enctype="multipart/form-data" name="ff1">
<div class="input-group mb-3">
<input type="text" id="username" name="username" placeholder="<?php echo $lang['USERNAME']; ?>" class="form-control" autofocus>
<div class="input-group-append">
<div class="input-group-text">
<span class="fas fa-user"></span>
</div>
</div>
</div>
<div class="input-group mb-3">
<input type="password" id="password" name="password" class="form-control" placeholder="<?php echo $lang['PASSWORD']; ?>">
<div class="input-group-append">
<div class="input-group-text">
<span class="fas fa-lock"></span>
</div>
</div>
</div>
<div class="row">
<div class="col-8">
<div class="icheck-primary">
<input type="checkbox" id="savelogin">
<label for="savelogin">
<?php echo $lang['REMEMBER_ME']; ?>
</label>
</div>
</div>
<!-- /.col -->
<div class="col-4">
<button type="submit" value="Submit" class="btn btn-primary btn-block"><?php echo $lang['SIGNIN']; ?></button>
<input type="hidden" value="yes" name="login" />
</div>
<!-- /.col -->
</div>
</form>
</div>
<!-- /.login-card-body -->
</div>
</div>
<!-- /.login-box -->
<!-- jQuery -->
<script src="assets/js/jquery/jquery.min.js"></script>
<!-- Bootstrap 4 -->
<script src="assets/js/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- AdminLTE App -->
<script src="assets/js/adminlte.min.js"></script>
<script src="assets/js/logout.js"></script>
</body>
</html>
<?php } ?>