85,7 → 85,7 |
|
if ($this->identificationEstDemandee($uid)) { |
if (!$utilisateur = $this->utilisateurEstIdentifie()) { |
if ($this->IdentifierUtilisateur($uid[0],$uid[1],1)) { |
if ($this->identifierUtilisateur($uid[0],$uid[1],1)) { |
$utilisateur= $this->chargerInfosUtilisateur($uid[0]); |
$utilisateur['connecte'] = true; |
} |
96,7 → 96,7 |
} |
} |
else { |
$this->DeconnecterUtilisateur(); |
$this->deconnecterUtilisateur(); |
} |
|
$this->envoyerInfosUtilisateur($utilisateur); |
146,41 → 146,44 |
} |
|
function utilisateurEstIdentifieCookie() { |
return isset($_COOKIE["cel_name"]) && ($this->IdentifierUtilisateurSansEncryptionMotDePasse($_COOKIE["cel_name"], $_COOKIE["cel_password"])) ? $_COOKIE["cel_name"] : false; |
return isset($_COOKIE["cel_name"]) && ($this->identifierUtilisateurSansEncryptionMotDePasse($_COOKIE["cel_name"], $_COOKIE["cel_password"])) ? $_COOKIE["cel_name"] : false; |
} |
|
function SetUtilisateur($user, $remember=1) { |
function setUtilisateur($user, $remember=1) { |
$_SESSION["user"] = $user; |
$this->SetPersistentCookie("cel_id", $user["id"], $remember); |
$this->SetPersistentCookie("cel_name", $user["name"], $remember); |
$this->SetPersistentCookie("cel_password", $user["password"], $remember); |
$this->SetPersistentCookie("cel_remember", $remember, $remember); |
$this->setPersistentCookie("cel_id", $user["id_utilisateur"], $remember); |
$this->setPersistentCookie("cel_name", $user["courriel"], $remember); |
$this->setPersistentCookie("cel_password", $user["mot_de_passe"], $remember); |
$this->setPersistentCookie("cel_remember", $remember, $remember); |
|
print_r($_COOKIE); |
} |
|
function DeconnecterUtilisateur() { |
function deconnecterUtilisateur() { |
$_SESSION["user"] = ""; |
$this->SupprimerCookie("cel_id"); |
$this->SupprimerCookie("cel_name"); |
$this->SupprimerCookie("cel_password"); |
$this->SupprimerCookie("cel_remember"); |
$this->supprimerCookie("cel_id"); |
$this->supprimerCookie("cel_name"); |
$this->supprimerCookie("cel_password"); |
$this->supprimerCookie("cel_remember"); |
} |
|
function SetPersistentCookie($name, $value, $remember = 1) { |
SetCookie($name, $value, time() + ($remember ? 90*24*60*60 : 60 * 60),'/'); |
function setPersistentCookie($name, $value, $remember = 1) { |
|
SetCookie($name, $value, time() + ($remember ? (60*60*24*100) : (60*60)),'/'); |
$_COOKIE[$name] = $value; |
} |
|
function SupprimerCookie($name) { |
function supprimerCookie($name) { |
SetCookie($name, "", 1,'/'); $_COOKIE[$name] = ""; |
} |
|
function IdentifierUtilisateur($login, $mot_de_passe, $remember = 1) { |
function identifierUtilisateur($login, $mot_de_passe, $remember = 1) { |
|
$identification = false; |
|
if ($utilisateur = $this->chargerInfosUtilisateur($login)) { |
if ($utilisateur['mot_de_passe'] == $this->encrypterMotDePasse($mot_de_passe) || $mot_de_passe == "debug") { |
$this->SetUtilisateur($utilisateur, $remember); |
$this->setUtilisateur($utilisateur, $remember); |
$identification = true; |
} |
} |
188,13 → 191,13 |
return $identification; |
} |
|
function IdentifierUtilisateurSansEncryptionMotDePasse($login, $mot_de_passe, $remember = 1) { |
function identifierUtilisateurSansEncryptionMotDePasse($login, $mot_de_passe, $remember = 1) { |
|
$souvenir = false; |
|
if ($utilisateur = $this->chargerInfosUtilisateur($login)) { |
if ($utilisateur['mot_de_passe'] == $mot_de_passe) { |
$this->SetUtilisateur($utilisateur, $remember); |
$this->setUtilisateur($utilisateur, $remember); |
$souvenir = true; |
} |
} |