Remember Me/ Cookie

Para master tolong bantuannya saya membuat vitur remember-me dari codingan berikut:

controller


  function index(){
    $this->load->view('login');
  }

  function auth(){
        $email=htmlspecialchars($this->input->post('email',TRUE),ENT_QUOTES);
        $nama=htmlspecialchars($this->input->post('username',TRUE),ENT_QUOTES);
        $password=htmlspecialchars($this->input->post('password',TRUE),ENT_QUOTES);
        $foto=htmlspecialchars($this->input->post('password',TRUE),ENT_QUOTES);

        $cek_user=$this->login_model->auth_user($email,$password,$foto,$nama);

        if($cek_user->num_rows() > 0){
        $data=$cek_user->row_array();
            $this->session->set_userdata('masuk',TRUE);

             if($data['level']=='1'){
                $this->session->set_userdata('akses','1');
                $this->session->set_userdata('ses_id',$data['id_akun']);
                $this->session->set_userdata('ses_nama',$data['username']);
                $this->session->set_userdata('ses_psw',$data['pass']);
                $this->session->set_userdata('ses_foto',$data['foto']);
                redirect('B1/Dashboard_b');

             }elseif($data['level']=='2'){

                $this->session->set_userdata('masuk',TRUE);
                $this->session->set_userdata('akses','2');
                $this->session->set_userdata('ses_id',$data['id_akun']);
                $this->session->set_userdata('ses_nama',$data['username']);
                $this->session->set_userdata('ses_psw',$data['pass']);
                $this->session->set_userdata('ses_foto',$data['foto']);
                redirect('S1/Dashboard_s');

              }elseif($data['level']=='3'){

                $this->session->set_userdata('masuk',TRUE);
                $this->session->set_userdata('akses','3');
                $this->session->set_userdata('ses_id',$data['id_akun']);
                $this->session->set_userdata('ses_nama',$data['username']);
                $this->session->set_userdata('ses_psw',$data['pass']);
                $this->session->set_userdata('ses_foto',$data['foto']);
                redirect('D1/Dashboard_d');
              }elseif($data['level']=='5'){

                $this->session->set_userdata('masuk',TRUE);
                $this->session->set_userdata('akses','5');
                $this->session->set_userdata('ses_id',$data['id_akun']);
                $this->session->set_userdata('ses_nama',$data['username']);
                $this->session->set_userdata('ses_psw',$data['pass']);
                $this->session->set_userdata('ses_foto',$data['foto']);
                redirect('M1/Dashboard_m');
              }
        }else{  // jika email dan password tidak ditemukan atau salah
            $url=base_url('index.php/login');
            echo $this->session->set_flashdata('msg','Username Atau Password Salah');
            redirect($url);
            }
      }

    function logout(){
        $this->session->sess_destroy();
        $url=base_url('');
        redirect($url);
    }
}

View


<div class="checkbox">
              <label>
                  <input type="checkbox" class="i-checks" value="remember-me"> Remember me
               </label>
  </div>

langkah yang harus dilakukan seperti apa dulu ya?, saya masih belum paham dari vitur remember -me

avatar ilhamhidayat
@ilhamhidayat

15 Kontribusi 0 Poin

Dipost 6 tahun yang lalu

Belum ada Jawaban. Jadi yang pertama Jawaban

Login untuk ikut Jawaban