Advertisement
lacasera

Untitled

Dec 29th, 2016
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. //login functiion
  2. public function authenticate()
  3. {
  4. $username = $this->input->post('uname');
  5. $password = $this->input->post('password');
  6. $pass = hash_password($password);
  7.  
  8. $res = $this->AppModel->fetch($username,$pass,'organisers');
  9.  
  10.  
  11. if ($res['email']==$username && $res['password']==$pass && $res['status']=='1') {
  12.  
  13. $array = array(
  14. 'logged_in' => true,
  15. 'user_id'=>$res['id'],
  16.  
  17. );
  18.  
  19.  
  20. $this->session->set_userdata( $array );
  21.  
  22.  
  23. redirect(base_url('home'),'refresh');
  24. }
  25. elseif ($res['email']==$username && $res['password']==$pass && $res['status']=='0') {
  26. //$data['error'] = "Please verify your account and continue";
  27. $data['phone_number'] = $res['phone_number'];
  28. $this->load->view('verification_view', $data);
  29.  
  30. }else {
  31. $data['error'] = "Invalid credentials. Please try again";
  32. $this->load->view('login_view', $data);
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement