-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
105 lines (90 loc) · 2.85 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
<?php
include("config/connection.php");
if (isset($_POST['submit'])) {
# code...
$username = $_POST['Username'];
$pass = $_POST['Password'];
$sql = "Select * from tblaccount where UserName = '$username' and Password = '$pass'";
$result = mysqli_query($conn, $sql);
$row = mysqli_fetch_array($result);
if ($row != NULL) {
$uId = $row['userId'];
$Fname = $row['FullName'];
$Type = $row['AccType'];
session_start();
$_SESSION['userId'] = $uId;
$_SESSION['FullName'] = $Fname;
$_SESSION['AccType'] = $Type;
if ($_SESSION['AccType'] == "Admin") {
header("location: admin/admin-dashboard.php");
die();
} else if ($_SESSION['AccType'] == "Encoder") {
header("location: encoder/dashboard.php");
die();
} else {
header("location: user.php");
die();
}
} else {
$error = "Your Login Name or Password is invalid";
}
} else {
$error = "";
}
?>
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="src/styles/index.css">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>National Telecommunications Commission</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
</head>
<body>
<!-- Modal HTML -->
<div class="login-box">
<h2>Member Login</h2>
<form action="" method="POST">
<div class="user-box">
<input type="text" name="Username" required="required" autocomplete="off">
<label>Username</label>
</div>
<div class="user-box">
<input type="password" name="Password" required="required" autocomplete="off">
<label>Password</label>
</div>
<div style="font-size:11px;color:#cc0000" class="error"><?php echo $error; ?></div>
<div class="center">
<button class="btn" name="submit" type="submit">
<svg width="100px" height="40px" viewBox="0 0 180 60" class="border">
<polyline points="179,1 179,59 1,59 1,1 179,1" class="bg-line" />
<polyline points="179,1 179,59 1,59 1,1 179,1" class="hl-line" />
</svg>
<span>Login</span>
</button>
</div>
</form>
<div class="footer">
<a class="forgot" href="#">Forgot Password?</a>
</div>
</div>
</body>
<script>
// forgot password on click
$(document).ready(function() {
$(".forgot").on("click", function() {
Swal.fire({
icon: 'warning',
text: 'Contact your administrator',
allowOutsideClick: false,
})
});
});
</script>
</html>