Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function login_post() {
- $username = trim($this->post('username'));
- $password = trim($this->post('password'));
- $this->db->select('*');
- $this->db->from('rtlh_users');
- $this->db->where('user_username', $username);
- $hasiluser = $this->db->get()->row(); // Hasil Cek Username
- if ($hasiluser == 0) {
- $response[] = array(
- 'resp_error' => TRUE,
- 'resp_msg' => 'Username Tidak Terdaftar.'
- );
- } else {
- $this->db->select('u.*, p.penduduk_nama');
- $this->db->from('rtlh_users u');
- $this->db->join('rtlh_penduduk_dukcapil p', 'u.user_username = p.penduduk_nik');
- $this->db->where('u.user_username', $username);
- $this->db->where('u.user_password', $password);
- $this->db->where('u.user_status', 'Aktif');
- $hasilakun = $this->db->get()->row(); // Hasil Cek Username dan Password
- if ($hasiluser == 0) {
- $response[] = array(
- 'resp_error' => TRUE,
- 'resp_msg' => 'Username atau Password Salah.'
- );
- } else {
- $response[] = array(
- 'resp_error' => FALSE,
- 'resp_msg' => 'Success',
- 'username' => trim($hasilakun->user_username),
- 'nama' => trim($hasilakun->penduduk_nama),
- 'avatar' => $hasilakun->user_image,
- 'level' => $hasilakun->user_level
- );
- }
- }
- $this->response($response, 200);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement