Advertisement
Guest User

Untitled

a guest
May 12th, 2016
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. //avoid Undefined variable
  2. $errors = [];
  3.  
  4. if (Input::exists('post'))
  5. {
  6. $validate = new Validate;
  7.  
  8. $validation = $validate->check($_POST, array(
  9. 'username' => array(
  10. 'required' => true
  11. ),
  12.  
  13. 'password' => array(
  14. 'required' => true
  15. )
  16. ));
  17.  
  18.  
  19. if ($validation->passed())
  20. {
  21.  
  22. $data = $this->_model->get_member_hash(Input::get('username'));
  23.  
  24. if (Password::password_verify(Input::get('password'), $data[0]->admin_password))
  25. {
  26. echo 'correct data';
  27. }
  28. else
  29. {
  30. echo 'incorrect data';
  31. }
  32. }
  33. else
  34. {
  35. $errors = $validation->errors();
  36. }
  37.  
  38. public function get_member_hash($username)
  39. {
  40. return $this->_db->read('SELECT * FROM ' . DATABASE_PREFIX . 'admins WHERE admin_email=:email OR admin_username=:username', array(
  41. ':email' => $username,
  42. ':username' => $username,
  43. ));
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement