Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function login()
- {
- $this->input = Kohana::instance()->input;
- $username = $this->input->post('username');
- $password = $this->input->post('password');
- $user = ORM::factory('user', $username);
- $this->auth = new Auth();
- $user->username = $username;
- $user->password = $password;
- if (!$user->loaded()) // if user is not found
- {
- echo "USERNAME not valid";
- } else if ($this->auth->login($username, $password)) { // if login() is returns TRUE
- echo "Hello, " . $this->auth->get_user()->username;// greet the user
- } else {
- echo "Login failed!";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement