Exemplo n.º 1
0
 public function generateLogin()
 {
     $logins_to_try = $this->get_all_possible_logins();
     $counter = 0;
     $login_to_try = array_shift($logins_to_try);
     while (!UserTable::check_if_login_exists($login_to_try)) {
         if (count($logins_to_try) == 0) {
             $counter++;
             $logins_to_try = $this->get_all_possible_logins($counter);
         }
         $login_to_try = array_shift($logins_to_try);
         // todo: make this better, maybe through a user->flash
         if ($counter == 5) {
             die('Too many attempts to find a login');
         }
     }
     $this->setLogin($login_to_try);
     return $login_to_try;
 }