forked from VinayShetyeOfficial/E-Learning-System
-
Notifications
You must be signed in to change notification settings - Fork 0
/
admin.php
45 lines (36 loc) · 1.06 KB
/
admin.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
<?php
if (!isset($_SESSION)) {
session_start();
}
include_once "../dbConnection.php";
// Admin Login verification
if (!isset($_SESSION["is_admin_login"])) {
if (
isset($_POST["checkLogemail"]) &&
$_POST["adminLogEmail"] &&
$_POST["adminLogPass"]
) {
$adminLogEmail = $_POST["adminLogEmail"];
$adminLogPass = $_POST["adminLogPass"];
$sql =
"SELECT admin_email, admin_pass FROM admin WHERE admin_email = '" .
$adminLogEmail .
"' AND admin_pass = '" .
$adminLogPass .
"'";
$result = $conn->query($sql);
$row = $result->num_rows;
if ($row == 1) {
echo json_encode($row);
// unsetting student login session if active
if (isset($_SESSION["is_login"])) {
unset($_SESSION["is_login"]);
}
$_SESSION["is_admin_login"] = true;
$_SESSION["adminLogEmail"] = $adminLogEmail;
} elseif ($row == 0) {
echo json_encode($row);
}
}
}
?>