I have a login system in a PHP
program that I want it to forwards users to different pages depending on your profile. There is a login table that has a field named " perfil
" which is either 0
or 1
. The goal is to route users depending on your profile to different pages. How can I do it in a simple way?
<?php
include ("incs/ligacao.inc.php");
include('session.php');
$user_check=$_SESSION['login_user'];
session_start();
$utilizador = $mysqli->query("SELECT perfil from login where username='$user_check'");
$result = $utilizador->fetch_assoc();
if($result['perfil'] == 0){
header('Location: menu.php');
}
elseif($result['perfil'] == 1){
header('Location:menu.php');
}
?>
Always stay on the login page when trying to do this