1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
$username = $this->_request->getPost('username');
$password = $this->_request->getPost('password');
$auth = false;
$md5pass = md5($password);
$annuaire = fopen('../application/configs/confsecours.txt', 'r'); //ouverture d'un fichier en lecture
if (isset($_POST['valider'])){
if($annuaire){
while (!feof($annuaire)){
$ligne=fgets($annuaire,42);
$tab=explode(":",$ligne);
if (($tab[0] === $username) && ($tab[1] === $md5pass)){
//echo "$tab[0]";
//echo "$tab[1]";
$auth =true;
echo "authentification réussie";
}
else{
echo "authentification échouée, veuillez recommencer";
$auth =false;
}
}
}
} |
Partager