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.
38 lines
946 B
38 lines
946 B
<?php
|
|
class ModelUser{
|
|
private $con;
|
|
private $gat;
|
|
|
|
public function __construct(Connection $con) {
|
|
$this->con = $con;
|
|
$this->gat = new GatUser($con); }
|
|
|
|
function ajouter($login, $mdp){
|
|
$user = findByLogin($login);
|
|
if (empty($user))
|
|
$gat->create($login, $mdp);
|
|
}
|
|
|
|
function supprimer($login){
|
|
$gat->delete($login);
|
|
}
|
|
|
|
function modifMdp($login, $mdp){
|
|
$gat->updateMdp($login, $mdp);
|
|
}
|
|
|
|
function modifLogin($login){
|
|
$user = findByLogin($login);
|
|
if (empty($user))
|
|
$gat->updateLogin($login);
|
|
}
|
|
|
|
function findByLogin($login){
|
|
if ($login !== " " && $login != null )
|
|
$results = $gat->find($login, "login");
|
|
$user = new User($results["login"]);
|
|
return $user;
|
|
}
|
|
}
|
|
|
|
?>
|