Advertisement
Guest User

Untitled

a guest
Mar 7th, 2019
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. <?php
  2.  
  3. /**
  4. *
  5. */
  6. class login extends CI_Controller
  7. {
  8.  
  9. function __construct()
  10. {
  11. parent::__construct();
  12. $this->load->model("m_user");
  13. }
  14.  
  15. function index(){
  16. if (!empty($this->session->userdata("USERNAME")))
  17. redirect(base_url("mobil"));
  18.  
  19. $this->load->view("v_login");
  20. }
  21.  
  22. function login_proses(){
  23. $username=$this->input->post("username");
  24. $password=md5($this->input->post("password"));
  25. $user=$this->m_user->login($username,$password);
  26.  
  27. if ($user) {
  28. $this->session->set_userdata((array)$user);
  29. redirect(site_url("mobil"));
  30. }else{
  31. redirect($this->index());
  32. }
  33. }
  34.  
  35. function logout(){
  36. $array_items = array('ID_USER','USERNAME','NAME','EMAIL','NO_TELP','JENIS_KELAMIN','ALAMAT','ACTIVATED','CREATED', 'GROUP_USER','LAST_LOGIN','LAST_UPDATE','PASSWORD','PHOTO');
  37. $this->session->unset_userdata($array_items);
  38. redirect($this->index());
  39. }
  40. }
  41.  
  42. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement