fix Username() redirection
This commit is contained in:
parent
df2d525f28
commit
5ecd0477f4
@ -7,7 +7,11 @@ function Username() {
|
||||
session_start();
|
||||
global $_SESSION, $winlog_url;
|
||||
if (!isset($_SESSION['username'])) {
|
||||
header('Location: '.$winlog_url);
|
||||
$destination = $winlog_url;
|
||||
if (isset($_SERVER['HTTP_REFERER'])) {
|
||||
$destination = $_SERVER['HTTP_REFERER'];
|
||||
}
|
||||
header('Location: '.$destination);
|
||||
exit();
|
||||
}
|
||||
return $_SESSION['username'];
|
||||
@ -19,29 +23,29 @@ function Username() {
|
||||
// autre => 0
|
||||
function Profil($username) {
|
||||
global $administrateurs, $superviseurs;
|
||||
global $niveaux, $lib_personnel;
|
||||
global $roles, $niveaux, $lib_personnel;
|
||||
if (in_array($username, $administrateurs)) {
|
||||
return $niveaux[3];
|
||||
return $niveaux[$roles[3]];
|
||||
}
|
||||
elseif (in_array($username, $superviseurs)) {
|
||||
return $niveaux[2];
|
||||
return $niveaux[$roles[2]];
|
||||
}
|
||||
else {
|
||||
$compte = Compte($username);
|
||||
if ($compte[2] == $lib_personnel) {
|
||||
return $niveaux[1];
|
||||
return $niveaux[$roles[1]];
|
||||
}
|
||||
else
|
||||
{
|
||||
return $niveaux[0];
|
||||
return $niveaux[$roles[0]];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Fonction FiltreProfil() : redirige vers interdit.php si profil inférieur à niveau Superviseur
|
||||
function FiltreProfil($profil) {
|
||||
global $niveaux;
|
||||
if ($profil < $niveau[2]) {
|
||||
global $niveaux, $roles;
|
||||
if ($profil < $niveaux[$roles[2]]) {
|
||||
header('Location: interdit.php');
|
||||
exit();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user