Codoforum related discussions
login session data lost after redirect to dashboard in server - codeigniter

My config

$config['sess_driver']= 'database';
$config['sess_cookie_name']= 'cisession';
$config['sess_expiration']= 7200;
$config['sess_save_path']= 'ci_session';
$config['sess_match_ip']= TRUE;
$config['sess_time_to_update']= 0;
$config['sess_regenerate_destroy']= FALSE;
$config['sess_use_database']= TRUE;
$config['sess_expire_on_close']= FALSE;
$config['sess_table_name']= 'ci_session';
$config['sess_match_useragent']=FALSE;

dashbord code

<?php

if (isset($_SESSION['uid']))
{
$uid = $this->session->userdata('uid');
//print_r($userdata);
}
else {
header("Location: admin");
}

?>

controller

public function login()
    {
        $email=$this->input->post('useremail');
        $pass=$this->input->post('password');
         $check=$this->modal->check_login($email,$pass);
         if(count($check)>0){

            $uid=$check[0]->id;
            $this->session->set_userdata('uid',$uid);
            echo 1; // redirect to dashboard 
        }

Using plesk server

**My config** ```` $config[&#039;sess_driver&#039;]= &#039;database&#039;; $config[&#039;sess_cookie_name&#039;]= &#039;cisession&#039;; $config[&#039;sess_expiration&#039;]= 7200; $config[&#039;sess_save_path&#039;]= &#039;ci_session&#039;; $config[&#039;sess_match_ip&#039;]= TRUE; $config[&#039;sess_time_to_update&#039;]= 0; $config[&#039;sess_regenerate_destroy&#039;]= FALSE; $config[&#039;sess_use_database&#039;]= TRUE; $config[&#039;sess_expire_on_close&#039;]= FALSE; $config[&#039;sess_table_name&#039;]= &#039;ci_session&#039;; $config[&#039;sess_match_useragent&#039;]=FALSE; ```` **dashbord code** ```` &lt;?php if (isset($_SESSION[&#039;uid&#039;])) { $uid = $this-&gt;session-&gt;userdata(&#039;uid&#039;); //print_r($userdata); } else { header(&quot;Location: admin&quot;); } ?&gt; ```` **controller** ```` public function login() { $email=$this-&gt;input-&gt;post(&#039;useremail&#039;); $pass=$this-&gt;input-&gt;post(&#039;password&#039;); $check=$this-&gt;modal-&gt;check_login($email,$pass); if(count($check)&gt;0){ $uid=$check[0]-&gt;id; $this-&gt;session-&gt;set_userdata(&#039;uid&#039;,$uid); echo 1; // redirect to dashboard } ```` **Using plesk server**
18
0
1
live preview
enter atleast 10 characters
WARNING: You mentioned %MENTIONS%, but they cannot see this message and will not be notified
Saving...
Saved
With selected deselect posts show selected posts
All posts under this topic will be deleted ?
Pending draft ... Click to resume editing
Discard draft