I have successfully created a registration and login system. I have used username and password in the login form and i want to put the userid in other form like hidden field
login model cliente.php:
public function login($username,$password){
$this->db->select('IdCliente');
$this->db->where('LoginCliente',$username);
$this->db->where('PassCliente',$password);
$q = $this->db->get('clientes');
if($q->num_rows()>0){
return true;
}else{
return false;
}
login controller login.php:
public function index(){
if($this->session->userdata('LoginCliente')){
redirect('profile');
}
if(isset($_POST['password'])){
$this->load->model('cliente');
if($this->cliente->loginemp($_POST['username'],$_POST['password'])){
$this->session->set_userdata('Login',$_POST['username']);
redirect('PanelIndex');
}elseif(isset($_POST['password'])){
$this->load->model('cliente');
if($this->cliente->login($_POST['username'],$_POST['password'])){
$this->session->set_userdata('LoginCliente',$_POST['username']);
$this->session->userdata('IdCliente');
redirect('profile');
}else{
redirect('login');
}
}
}
$this->load->view('inicio/loginview');
}
profile.php
public function index()
{
$this->load->view("/clientes/clienteindex");
}