Guest User

Untitled

a guest
Oct 18th, 2018
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.83 KB | None | 0 0
  1. public function Adduser(){
  2. $data['akses']=$this->us->Get_akses('user','Akses');
  3. foreach($data as $key=>$r){
  4.  
  5. }
  6. $data['isi']='opp/add_user';
  7. $this->load->view('template_ope',$data);
  8. }
  9.  
  10. public function tambah_user(){
  11. $nik=$this->input->post('nik');
  12. $nama=$this->input->post('nama');
  13. $almt=$this->input->post('almt');
  14. $user=$this->input->post('user');
  15. $pass=$this->input->post('pass');
  16. $akses=$this->input->post('akses');
  17.  
  18. $this->form_validation->set_rules('nik', 'Nik', 'required|alpha_dash|min_length[7]|max_length[7]|callback_username_check');
  19. $this->form_validation->set_rules('nama', 'nama', 'required');
  20. $this->form_validation->set_rules('almt', 'Alamat', 'required');
  21. $this->form_validation->set_rules('user', 'Username', 'required');
  22. $this->form_validation->set_rules('pass', 'Password', 'required');
  23. if ($this->form_validation->run() == FALSE)
  24. {
  25. $this->session->set_flashdata('msg', 'Periksa Kembali Semua Data !!!');
  26. redirect('operator/Adduser','refresh');".";
  27. }
  28. else
  29. {
  30. $data_user=$this->us->lihat_user($nik);
  31. if ($data_user['NIK']==$nik and $data_user['username']=$user) {
  32. $this->session->set_flashdata('msg', 'Duplikat NIK dan username!!!');
  33. redirect('operator/Adduser','refresh');".";
  34. }
  35. elseif($data_user['NIK']==$nik or $data_user['username']=$user){
  36. $this->session->set_flashdata('msg', 'Duplikat NIK atau username!!!');
  37. redirect('operator/Adduser','refresh');".";
  38. }
  39. $this->us->tambah( $nik,$nama,$almt,$user,$pass,$akses);
  40. $this->session->set_flashdata('msg', 'Data Berhasil Disimpan !!!');
  41. redirect('operator/user/','refresh');".";
  42.  
  43. }
  44. }
Add Comment
Please, Sign In to add comment