En userdata borro los datos:
Código PHP:
if (isset($_POST['exit'])) $this->session->sess_destroy();
Código PHP:
<?php defined('BASEPATH') OR exit('No direct script access allowed');
class Usuario extends MY_Controller {
public function __construct(){
parent::__construct();
$this->data['title']='titulo';
$this->data['class']=strtolower(__class__);
$this->data['user']=isset($_POST['user']) ? $_POST['user'] : null ;
$this->data['pass']=isset($_POST['pass']) ? crypt($_POST['pass'],'gmv') : null;
}
public function index(){
$con = $this->db->get_where(strtolower(__class__),['user'=>$this->data['user'],'pass'=>$this->data['pass']])->result();
if ($con&&$con=$con[0])
$this->session->set_userdata(['id_user'=>$con->id_user,'user'=>$con->user,'level'=>$con->level]);
if (isset($_POST['exit'])) $this->session->sess_destroy();
$this->load->view('layout/header',$this->data);
$this->load->view(strtolower(__class__),$this->data);
$this->load->view('layout/footer',$this->data);
}
}
Código PHP:
<?php if ($this->session->userdata('user')): ?>