Advertisement
Guest User

Untitled

a guest
Jun 2nd, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. public function action_formAction()
  2. {
  3. $error_login = '';
  4. if($_POST){
  5. $data_entry = new Model_User();
  6. $user_data = $data_entry->fetch_where(array(array('username','=', $_POST['name'])));
  7. $count = $user_data->count();
  8. if($count != 0){
  9.  
  10. $user_name = $_POST['name'];
  11. $password = $_POST['password'];
  12. //$user_data = $data_entry->fetch_where(array(array('password','=', $_POST['password'])));
  13. $count = $user_data->count();
  14.  
  15. if( Model_User::from_name($user_name)->check_password($password)){
  16. Session::instance()->set('user_name', $user_name);
  17. $this->request->redirect(url::base() . 'index/show');
  18. }
  19.  
  20. else{
  21. $error_login = 'wachtwoord incorrect ingevoerd!';
  22. }
  23. }
  24. else{
  25. $error_login = 'Gebruikersnaam bestaat niet!';
  26. }
  27.  
  28. $this->template->content = View::factory('loginForm')
  29. ->set('form_action', 'formAction')
  30. ->set('error_login', $error_login)
  31. ->render();
  32.  
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement