コード例 #1
0
 function ValidationConnexion()
 {
     global $rep, $vue;
     $connexion = true;
     if (!isset($_POST['password'])) {
         $_POST['password'] = "";
     }
     if (!isset($_POST['login'])) {
         $_POST['login'] = "";
     }
     $tabVal['password'] = $_POST['password'];
     $tabVal['login'] = $_POST['login'];
     $tabVal = Validation::cleanTab($tabVal);
     $tabBool = Validation::validateTab($tabVal);
     foreach ($tabBool as $key => $value) {
         if (!$value) {
             $connexion = false;
         }
     }
     if ($connexion) {
         $resCo = AdminModel::selectAdmin();
         if ($tabVal['password'] != $resCo[0]['mdp']) {
             $tabBool['password'] = 0;
             $connexion = FALSE;
         }
         if ($tabVal['login'] != $resCo[0]['login']) {
             $tabBool['login'] = 0;
             $connexion = FALSE;
         }
         if ($connexion) {
             require $rep . $vue['vueAdmin'];
         } else {
             $validPassword = false;
             require $rep . $vue['login'];
         }
     } else {
         require $rep . $vue['login'];
     }
 }