Advertisement
ak47suk1

Untitled

May 26th, 2011
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.15 KB | None | 0 0
  1.     function validate_credentials() {
  2.         $this->load->model('eloki_model');
  3.         $query = $this->eloki_model->validateUser();
  4.         $query2 = $this->eloki_model->validateAdmin();
  5.         $username = $this->input->post('username');
  6.         if ($query) {
  7.  
  8.             if ($query2) {
  9.  
  10.                 $data = array(
  11.                     'username' => $username,
  12.                     'is_logged_in' => true,
  13.                     'is_admin' => true
  14.                 );
  15.             } else {
  16.                 $data = array(
  17.                     'username' => $username,
  18.                     'is_logged_in' => true
  19.                 );
  20.             }
  21.  
  22.             $this->session->set_userdata($data);
  23.  
  24.             $this->session->keep_flashdata('prev_page');
  25.             if ($this->session->flashdata('prev_page') == base_url() || base_url() . '/taxonomy') {
  26.                 redirect('controlpanel');
  27.             } else {
  28.                 redirect($this->session->flashdata('prev_page'));
  29.             }
  30.         } else {
  31.  
  32.             $data['main_content'] = 'login_error';
  33.             $this->load->view('includes/templatetest', $data);
  34.         }
  35.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement