-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.php
31 lines (28 loc) · 963 Bytes
/
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
<?php
require_once('config.php'); // Include your config.php file
// Start the session
// Check if the user is not logged in (assuming 'login_type' is set to 1 for logged-in users)
if (!isset($_SESSION['userdata']['login_type'])) {
redirect('login');
exit; // Make sure to exit after the redirection
}
// Get the user type from the session data
$type = isset($_SESSION['userdata']['type']) ? intval($_SESSION['userdata']['type']) : null;
// Use a switch statement for better readability
switch ($type) {
case 1:
redirect('admin'); // Redirect to the 'admin' directory or page
break;
case 2:
redirect('staff'); // Redirect to the 'staff' directory or page
break;
case 3:
redirect('bod'); // Redirect to the 'bod' directory or page
break;
case 4:
redirect('vendor'); // Redirect to the 'bod' directory or page
break;
default:
echo 'User type not available';
}
?>