Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function login() {
- $validate = new \Models\Validate();
- $user_name = \Models\Sanitaze::clear($_POST['user_name']);
- $user_password = \Models\Sanitaze::clear($_POST['user_password']);
- $user_name_errors = $validate->setData($user_name)->required()->min_length("3")->max_length("40")->getErrors();
- $user_password_errors = $validate->setData($user_password)->required()->min_length("7")->max_length("40")->getErrors();
- if (empty($user_name_errors) && empty($user_password_errors)) {
- $auth = new \Models\Auth();
- $auth->login(array('user_name' => $user_name, 'user_password' => $user_password));
- if (empty($auth->getErrors())) {
- Models\Cookies::set(\Models\Config::get("remember_me/cookie_name"), \Models\Session::createSession($auth->getResult()));
- }
- } else {
- echo "Errors";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement