Welcome Guest, Not a member yet? Register   Sign In
set, view as well as unset session data using rapyd session
#1

[eluser]ranjitbd[/eluser]
/*Code Igniter session class is cookie based, does not utilize native PHP sessions.
Rapyd Session class instead use native PHP sessions.*/

//i already set session array using CI
function loginCheck()
{
$email = $this->input->post('contact_email',true);
$password = $this->input->post('password',true);
$this->load->model($this->config->item('userModel'), 'login_user',TRUE);
$result = $this->login_user->userLoginCheck($email,$password);

if($result)
{
$newData = array('name'=>$result->first_name,'lastName'=>$result->last_name, 'logged_in'=>TRUE);
$this->session->set_userdata($newData);
redirect('holiday/index');
}
else
{
$newData=array( 'log_mess'=>'invalid user name or password', 'logged_in'=>FALSE);
$this->session->set_userdata($newData);
redirect('holiday/login');
}
}

//for viewing as well as checking the session and unset the session with CI
<?php
if($this->session->userdata('logged_in')==TRUE && $this->session->userdata('name')!= '')
{
echo "Welcome :".strtoupper($this->session->userdata('name'))." ";
$this->session->unset_userdata('name'); //here i unset only name.but how can i unset the whole array.below the code:

//$this->session->unset($userdata);/ i want this but not working...

}
?>


2nd question: what to do for doing same tasks with rapyd session (set, view as well as unset).




Theme © iAndrew 2016 - Forum software by © MyBB