Hi,
i have a basic login script that directs users to a page once logged in, i would like to direct different users to different pages based on their username
eg; user1 would log in and be directed to domain.com/user1
user2 would log in and be directed to domain.com/user2
also, user2 shouldn't be able to change the address to domain.com/user1 and be allowed access to that folder and so on.
the usernames and passwords are stored in a mysql db and there is no requirement for the users to be able to change them.
Am i right in thinking this is the bit of code i need to change?
Please could someone offer some help/advice on how to implement this?
Thanks
i have a basic login script that directs users to a page once logged in, i would like to direct different users to different pages based on their username
eg; user1 would log in and be directed to domain.com/user1
user2 would log in and be directed to domain.com/user2
also, user2 shouldn't be able to change the address to domain.com/user1 and be allowed access to that folder and so on.
the usernames and passwords are stored in a mysql db and there is no requirement for the users to be able to change them.
Am i right in thinking this is the bit of code i need to change?
PHP Code:
function validate_user($un, $pwd) {
$mysql = New Mysql();
$ensure_credentials = $mysql->verify_Username_and_Pass($un, md5($pwd));
if($ensure_credentials) {
$_SESSION['status'] = 'authorized';
header("location: index.php");
} else return "Please enter a correct username and password";
}
Thanks
Comment