Guest User

Untitled

a guest
Jul 20th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. <?PHP
  2.  
  3. class Login extends Controller {
  4.  
  5. function Login()
  6. {
  7. parent::Controller();
  8. }
  9.  
  10. function index()
  11. {
  12.  
  13. $this->form_validation->set_rules('email', 'email', 'required');
  14. $this->form_validation->set_rules('password', 'password', 'required');
  15. // Load user model
  16. $this->load->model('users');
  17.  
  18. if ($this->form_validation->run() == FALSE){
  19. $this->load->view('login');
  20. } else {
  21. if ($this->users->login($_POST['email'],$_POST['password']) == FALSE){
  22. $this->form_validation->set_message('login', 'Sorry, but that email and/or password cannot be found.');
  23. $this->load->view('login');
  24. } else {
  25. // Success, forward
  26. redirect('dashboard');
  27. }
  28. }
  29. }
  30. }
  31.  
  32. ?>
Add Comment
Please, Sign In to add comment