Display user name logged in with CodeIgniter
How do I display the user name logged into the system?
The function that authenticates and creates the session is this:
function verificar()
{
$this->load->model('tbdaluno');
$check = $this->tbdaluno->validar();
if($check)
{
$this->session->set_userdata('aluno', $check);
redirect('dashboard');
}
else
{
redirect('');
}
}
1
Author: igorarmelin, 2019-08-02
1 answers
Within your if/else
condition creates a variable for the SESSION
that has been set, and passes the variable in $load
, or in a very rustic way, in your View
use $_SESSION['aluno']
.
function verificar()
{
$this->load->model('tbdaluno');
$check = $this->tbdaluno->validar();
if($check)
{
$dados['aluno'] = $this->session->set_userdata('aluno', $check);
redirect('dashboard',$dados);
}
else
{
redirect('');
}
}
0
Author: Diêgo Correia de Andrade, 2019-08-09 20:35:54