Example #1
0
 public function save()
 {
     $param = $this->input->post();
     $this->load->library('form_validation');
     $this->form_validation->set_rules('tgl_lahir', 'Tgl Lahir', 'trim|required|xss_clean');
     $this->form_validation->set_rules('nama', 'Nama', 'trim|required|xss_clean');
     $this->form_validation->set_rules('no_ktp', 'No KTP', 'trim|required|xss_clean');
     $this->form_validation->set_rules('alamat', 'Alamat', 'trim|required|xss_clean');
     $this->form_validation->set_rules('telp', 'No. Telp', 'trim|numeric|required|xss_clean');
     $this->form_validation->set_rules('email', 'Email', 'trim|valid_email|xss_clean');
     $this->form_validation->set_rules('status', 'Status', 'trim|required|xss_clean');
     $this->form_validation->set_rules('compliment', 'Compliment', 'trim|required|xss_clean');
     $this->form_validation->set_rules('id', 'fieldlabel', 'trim|xss_clean');
     $this->form_validation->set_rules('uname', 'Username', 'trim|required|xss_clean');
     $this->form_validation->set_rules('upass', 'Password', 'trim|required|xss_clean');
     // $this->form_validation->set_rules('confirm-upass', 'Password Confirm', 'trim|required|xss_clean');
     $this->form_validation->set_rules('group', 'Jabatan', 'trim|required|xss_clean');
     if ($this->form_validation->run() == FALSE) {
         echo "0|" . warn_msg(validation_errors());
     } else {
         // if($param['upass']==$param['confirm-upass']){
         $id = $param['id'];
         unset($param['id']);
         unset($param['xxx']);
         $param['upass'] = paramEncrypt($param['upass']);
         $param['nik'] = $param['code'];
         unset($param['code']);
         if ($id == NULL) {
             $where = array('no_ktp' => $param['no_ktp']);
             $exist = $this->mkn->total('atombizz_employee', $where);
             if ($exist <= 0) {
                 $where = array('uname' => $param['uname']);
                 $exist = $this->mkn->total('atombizz_employee', $where);
                 if ($exist <= 0) {
                     $save = $this->mkn->write('atombizz_employee', $param);
                     if ($save == TRUE) {
                         echo "1|" . succ_msg("Pengguna berhasil ditambahkan");
                     } else {
                         echo "0|" . err_msg("Gagal, coba periksa lagi inputan anda.");
                     }
                 } else {
                     echo "0|" . err_msg("Gagal, coba periksa lagi inputan anda.");
                 }
             } else {
                 echo "0|" . err_msg("Data sudah ada.");
             }
         } else {
             $where = array('id' => $id);
             $update = $this->mkn->replace('atombizz_employee', $param, $where);
             if ($update == TRUE) {
                 echo "1|" . succ_msg("Pengguna berhasil dirubah.");
             } else {
                 echo "0|" . err_msg("Gagal, coba periksa lagi inputan anda.");
             }
         }
         // } else {
         //     echo '0|'.warn_msg('Password yang dimasukkan tidak sama.');
         // }
     }
 }
Example #2
0
 public function get_surat($param = '')
 {
     $sql = "SELECT * FROM view_pengiriman WHERE id = ? ";
     $query = $this->db->query($sql, $param);
     if ($query->num_rows() > 0) {
         $data = $query->row();
         $kode = paramEncrypt($data->invoice_no);
         return $kode;
     } else {
         return FALSE;
     }
 }
Example #3
0
 public function login($param = '')
 {
     $password = paramEncrypt($param['login-password']);
     $where = array('uname' => $param['login-email'], 'upass' => $password);
     $query = $this->find('view_employee', $where, $field = NULL, $limit = NULL, $orderby = NULL, $join = FALSE, $like = FALSE);
     if ($query == NULL) {
         $data = FALSE;
     } else {
         $data = $query->result();
     }
     return $data;
 }
Example #4
0
 public function valid_compliment($param = '')
 {
     $password = paramEncrypt($param['upass']);
     $where = array('uname' => $param['uname'], 'upass' => $password);
     $query = $this->find('view_employee', $where, $field = NULL, $limit = NULL, $orderby = NULL, $join = FALSE, $like = FALSE);
     if ($query == NULL) {
         return FALSE;
     } else {
         return TRUE;
     }
 }