Пример #1
0
 public static function isLoggedIn()
 {
     if (!empty($_SESSION['Email']) && !empty($_SESSION['Wachtwoord'])) {
         $email = $_SESSION['Email'];
         $pass = $_SESSION['Wachtwoord'];
         $registerSession = false;
     } else {
         if (!empty($_POST['txtEmail']) && !empty($_POST['txtWachtwoord'])) {
             $email = $_POST['txtEmail'];
             $pass = encrypt($_POST['txtWachtwoord']);
             $registerSession = true;
         } else {
             return false;
         }
     }
     if (($gebruiker = Gebruiker::getByEmailAndPass($email, $pass)) !== false) {
         if ($registerSession) {
             $_SESSION['GebruikerID'] = $gebruiker->getProperty('GebruikerID');
             $_SESSION['GroepID'] = $gebruiker->getProperty('GroepID');
             $_SESSION['BedrijfID'] = $gebruiker->getProperty('BedrijfID');
             $_SESSION['Aanmaker'] = $gebruiker->getProperty('Aanmaker');
             $_SESSION['Email'] = $email;
             $_SESSION['Wachtwoord'] = $pass;
         }
         return true;
     } else {
         return false;
     }
 }