-
Notifications
You must be signed in to change notification settings - Fork 0
/
check.php
54 lines (34 loc) · 1.2 KB
/
check.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
<?php
session_start();
if(isset($_SESSION['email'])) {
$userEmail = $_SESSION['email'];
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "signup";
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT user_type FROM registration WHERE email='$userEmail'";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
if ($row["user_type"] === "manager") {
header("Location: assign_task.html");
exit();
} else {
echo '<script>alert("Sorry, this feature is not available for you."); window.location.href = "dashboard.html";</script>';
header("Refresh: 3; URL=dashboard.html");
exit();
}
}
} else {
echo "User not found.";
}
$conn->close();
} else {
header("Location: login.html");
exit();
}
?>