I want to redirect the users from the same log-in page.
folder structure...
root
|
--------/application/app.php <---------- for normal user
|
--------/administration/admin.php <------- for admin user
|
-------- index.php (Log-in page)
User Table
ID USER_NAME PASSWORD USER_TYPE
1 admin pass@admin admin
2 user pass@user user
If the login user's user type is admin then he/she will be redirected to /administration/admin.php
else /application/app.php
.
How can I do it ?
Regards,
Try something like this:
<?php
$userType = $row['user_type'];
if($userType == 'admin'){
header("Location: /administration/admin.php"); // This line triggers a redirect if the user_type is admin
} else {
header("Location: /application/app.php"); // This line triggers for other user_types
}
?>
$row['user_type'];
is simulating your SELECT
from your database, I won't write the connection script for you, but this is just a guideline into what you need to look into. Also, look into PDO or MySQLi as MySQL is deprecated.