Exemplo n.º 1
0
 $clean = $text->clean;
 $errors = array();
 $baddata = false;
 if (!empty($_POST)) {
     // data was submitted, check to see if it's good
     $clean = $text->clean;
     if ($text->is_missing_required) {
         $baddata = true;
     }
     // username exists?
     if (!$baddata && !$user->userExists($clean['username'])) {
         $baddata = true;
         $errors[] = $l['log-bad-user'];
     }
     // password works for username?
     if (!$baddata && !$user->checkPass($clean['password'], $clean['username'])) {
         $baddata = true;
         $errors[] = $l['log-bad-pass'];
     }
     // login user?
     if (!$baddata) {
         $user->setIdByName($clean['username']);
         if ($user->get('valid') == 1) {
             // user is valid
             $user->login($config->get('login_time'));
             $ets->page_body = $l['log-good'];
         } else {
             $ets->page_body = $l['log-check-email'];
         }
     }
 }