Advertisement
Guest User

Untitled

a guest
Jun 15th, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.86 KB | None | 0 0
  1. public function start($user, $password) {
  2.         $conn = MySQL::getInstance()->getConnector();
  3.         $DAO = new DAO();
  4.         $user = new StringExpression($user);
  5.         $password = new StringExpression($password);
  6.        
  7.         if($flood = Cookie::getInstance()->get('flooding')){
  8.             $this->last_message = 'Acesso bloqueado por 5 minutos!';
  9.             $this->notify();
  10.             header('Location: '.URL_ROOT.'login.php');
  11.             return  false;
  12.         }
  13.        
  14.         $DAO->select()->table('users')->where("user_name = {$user->interpret($conn)} AND user_pswd = MD5({$password->interpret($conn)})");
  15.         if($result = $DAO->fetchOne()){
  16.             Session::getInstance()->set('uid', $result['uid']);
  17.             $this->last_message = null;
  18.             $this->notify();
  19.             header('Location: '.URL_ROOT);
  20.         } else {
  21.             $this->last_message = 'Usuário e/ou senha incorretos!';
  22.             $this->notify();
  23.             header('Location: '.URL_ROOT.'login.php');
  24.         }
  25.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement