Advertisement
fabi0

Untitled

May 19th, 2014
258
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.92 KB | None | 0 0
  1. public function login() {
  2.  
  3.         $validate = new \Models\Validate();
  4.         $user_name = \Models\Sanitaze::clear($_POST['user_name']);
  5.         $user_password = \Models\Sanitaze::clear($_POST['user_password']);
  6.         $user_name_errors = $validate->setData($user_name)->required()->min_length("3")->max_length("40")->getErrors();
  7.         $user_password_errors = $validate->setData($user_password)->required()->min_length("7")->max_length("40")->getErrors();
  8.  
  9.         if (empty($user_name_errors) && empty($user_password_errors)) {
  10.             $auth = new \Models\Auth();
  11.             $auth->login(array('user_name' => $user_name, 'user_password' => $user_password));
  12.             if (empty($auth->getErrors())) {
  13.                 Models\Cookies::set(\Models\Config::get("remember_me/cookie_name"), \Models\Session::createSession($auth->getResult()));
  14.             }
  15.         } else {
  16.             echo "Errors";
  17.         }
  18.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement