public function login() { $encrypt = new Encrypt_2015(); $username = $this->input->post('username', true); $password = $encrypt->_base64_encrypt($this->input->post('password')); $check = $this->orm->user->where('username = ? AND password = ?', $username, $password); $data = array(); $result = array(); if (count($check) != 0) { $user = $check->fetch(); $data['username'] = $user['username']; $data['password'] = $user['password']; $data['namalengkap'] = $user['namalengkap']; $data['nomorhp'] = $user['nomorhp']; $data['email'] = $user['email']; $data['idrole'] = $user['idrole']; $data['role'] = $user->role['role']; $data['idrefstore'] = $user['idrefstore']; $data['nama_store'] = $user->refstore['nama']; $data['tlp_store'] = $user->refstore['tlp']; $data['email_store'] = $user->refstore['email']; $data['lokasi_store'] = $user->refstore['lokasi']; $data['keterangan_store'] = $user->refstore['keterangan']; $result['status'] = true; $result['messages'] = 'Berhasil Login'; $result['user'] = $data; } else { $result['status'] = true; $result['messages'] = 'Berhasil Login'; $result['user'] = $data; } echo json_encode($result); }
function encrypt_callback($text) { $encrypt = new Encrypt_2015(); $ency = $encrypt->_base64_encrypt($text, $this->config->item('encryption_key')); return $ency; }