Welcome Guest, Not a member yet? Register   Sign In
Sessions not working on CI 3
#1

Hi;

I create session manually and it works fine locally but not when I upload it to server. Can anyone see what I am doing wrong?

'Thanks

Creating session in controller
PHP Code:
if($_POST)
 {
 if((
strlen($_POST['comment'])>2) && ($_POST['secret']==5))
 {
 
$data = array(
 
  'comment' => $_POST['comment'],
 
  'page_id' => $this->data['id'],
 
  'email' => $_POST['email'],
 
  'date_added' => date('Y-m-d')
 );
 
$this->db->insert('breakup_comments'$data);
 
$_SESSION['comment_added'] = '<strong class = "green">Your comment has been added successfully! It will appear in a couple hours :)</strong><br /><br />';
 
redirect($this->data['return_path'], 'refresh');
 }



Viewing..well trying to
PHP Code:
if(isset($_SESSION['comment_added']))
 
             {
 
               if(strlen($_SESSION['comment_added'])>3)
 
                 {
 
                   echo $_SESSION['comment_added'];
 
                   $_SESSION['comment_added'] = "";
 
                  
              

Reply
#2

You should see what session driver you're using. Most likely you're using file driver. If that is the case, you must make sure the directory mentioned inside the config.php is writable: http://www.codeigniter.com/user_guide/li...les-driver
Reply




Theme © iAndrew 2016 - Forum software by © MyBB