Example #1
0
 public function process()
 {
     $account_model = new account_model();
     $data = array();
     $this->output->enable_profiler(FALSE);
     $email = $this->input->post('email');
     $password = $this->encrypt_callback($this->input->post('password'));
     if (!empty($email) || !empty($password)) {
         if ($account_model->cekLogin($email, $password)) {
             $user = $this->orm->useraccount->where('email', $email)->fetch();
             $data['namalengkap'] = $user['namalengkap'];
             $data['nomorhp'] = $user['nomorhp'];
             $data['email'] = $user['email'];
             $data['alamat'] = $user['alamat'];
             $data['idrole'] = $user['idrole'];
             $data['image_file'] = $user['image_file'];
             $data['idrefstore'] = $user['idrefstore'];
             $data['role'] = $user->role['role'];
             $_SESSION['user'] = $data;
             $_SESSION['login'] = TRUE;
             $account_model->insertLogs(1);
             redirect('home/dashboard/');
         } else {
             redirect('login');
         }
     } else {
         redirect('login');
     }
 }