1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| // code igniter ??
$username = $this->_request->getPost('username');
$password = $this->_request->getPost('password');
$auth = false;
$md5pass = md5($password);
$annuaire = fopen('../application/configs/confsecours.txt', 'r');
if (isset($_POST['valider']) && $annuaire){
while (!feof($annuaire)){
$data = fgetcsv($annuaire,42,':');
if (!array_filter($data))
continue; // sauter les lignes vides
if ($auth = isset($data[0],$data[1]) && $data[0] == $username && $data[1] == $md5pass)
break; // plus besoin de continuer
}
if ($auth)
echo "authentification réussie";
else
echo "authentification échouée, veuillez recommencer";
} |
Partager