Welcome Guest, Not a member yet? Register   Sign In
session
#1

[eluser]Professor Doidão[/eluser]
how I can use session for login


#2

[eluser]InsiteFX[/eluser]
1) build a form for the user to register. Get the input and save it to the database.
2) build a form for the user to enter their information login and password. Check the user against the users database record.

3) If the user passes then save the information to the session ( logged_in = TRUE )

I would download one of the Auth libraries in the forums and see how they do it.
#3

[eluser]Professor Doidão[/eluser]
I make this


function logar(){
$this->load->model('Grud');
$this->load->library('form_validation');
$this->form_validation->set_rules('nome', 'nome', 'required');
$this->form_validation->set_rules('senha', 'senha', 'required');
if ($this->form_validation->run() == true) {




$data['UsuNome'] = $this->input->post('nome');
$data['UsuSenha'] = $this->input->post('senha');

$logado = $this->Grud->logado($data);


if($logado>0){
$login = $this->Grud->login($data);

foreach ( $login as $user){

$newdata = array(
'username' => $user->UsuNome,
'email' => $user->UsuSenha,
'permissao' =>$user->UsuPermissao,
'logged_in' => TRUE
);
}
$this->session->set_userdata($newdata);
if ($this->session->userdata('permissao')=='administrador'){
$this->index();
}
else{

redirect(base_url().'index.php/produto','refresh');
}
}
}

else{
$this->load->view('adm/frm_login.php');
}


}


but be error
#4

[eluser]Professor Doidão[/eluser]
was a Archive that was error


thanks




Theme © iAndrew 2016 - Forum software by © MyBB