You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
937 B
36 lines
937 B
<?php
|
|
|
|
class MdlAdmin
|
|
{
|
|
public function connection($login, $mdp){
|
|
global $dsn,$user,$pass;
|
|
$gatewayAdmin = new GatewayAdmin(new Connection($dsn,$user,$pass));
|
|
|
|
if(password_verify($mdp,$gatewayAdmin->getCredential($login))){
|
|
$_SESSION['role']='admin';
|
|
$_SESSION['login']=$login;
|
|
return new Admin($login,$_SESSION['role']);
|
|
}
|
|
else{
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
|
|
public function déconnexion(){
|
|
session_unset();
|
|
session_destroy();
|
|
$_SESSION = array();
|
|
}
|
|
|
|
public function isAdmin(){
|
|
if(isset($_SESSION['login']) && isset($_SESSION['role'])) {
|
|
$login = /*Nettoyer::nettoyer_string(*/$_SESSION['login']/*)*/;
|
|
$role = /*Nettoyer::nettoyer_string(*/$_SESSION['role']/*)*/;
|
|
return new Admin($login,$role);
|
|
}
|
|
else{
|
|
return null;
|
|
}
|
|
}
|
|
} |