I'm currently building a website that has a log in form. Depending on which role this user has a navigation bar has to be displayed accordingly.
For Example : Someone who hasn't yet logged in will have a "login" link. If someone has logged in and is not an admin a different nav bar is displayed.
All log in details are stored in a db and this has to be done using sessions since it will send the user to a different page.
Any ideas ?
Code till now :
$query = "SELECT count(*) FROM tbl_users
WHERE username = '$username' AND password = '$pass'";
$result = mysqli_query($connection, $query)
or die("Error in query: ". mysqli_error($connection));
$row = mysqli_fetch_row($result);
$counter = $row[0];
if($counter > 0)
{
session_start();
$_SESSION['user']= $username;
$_SESSION['role'] = $row['role'];