-
Notifications
You must be signed in to change notification settings - Fork 6
/
do_login.php
39 lines (33 loc) · 945 Bytes
/
do_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
<?php
include_once 'config/config.php';
if (empty($_POST['username']) || empty($_POST['password'])) {
header("location: ./index.php");
}
$user_name = $_POST['username'];
$password = $_POST['password'];
$check_query = "
SELECT
*
FROM " . TBL_EMPLOYEE . "
WHERE
Email='" . $user_name . "' AND
Password='" . sha1($password) . "' AND
Status=1
";
$db_obj = mysqli_query($connection_obj, $check_query);
if (mysqli_num_rows($db_obj) > 0) {
$employee_data = mysqli_fetch_assoc($db_obj);
if (!empty($employee_data) && is_array($employee_data) && count($employee_data) > 0) {
$store_seesion = array(
"employee_id" => $employee_data['Employee_id'],
"admin_role" => $employee_data['Roles']
);
$_SESSION = $store_seesion;
header("location: ./dashboard.php");
} else {
header("location: ./index.php");
}
} else {
header("location: ./index.php");
}
?>