Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8641999
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T11:40:04+00:00 2026-06-12T11:40:04+00:00

I am facing problems in codeigniter 2.x session class. I want to have userid

  • 0

I am facing problems in codeigniter 2.x session class. I want to have userid in session for global access on my pages after user login

I have 2 views and 1 controller
one view one i had a login form when a user submits the form
i validate it and create session user data by calling a method within controller as

function create_session($data) {        
        $mydata = array(
                   'userid'  => $data,
                   'role'     => $role,
                   'logged_in' => TRUE
               );

        $this->session->set_userdata($mydata);

        return;
    }

then my 2nd view is loaded
and i have on that view

print_r($this->session->userdata); 

and it print out the right results

but when i click on 1st view in navigation
i fond that

[userdata] => 

its empty
my session configuration is as

$config['encryption_key'] = 'askdfjowieuriomzx,mv';
$config['sess_cookie_name'] = 'wana_session';
$config['sess_expiration'] = 7200;
$config['sess_expire_on_close'] = FALSE;
$config['sess_encrypt_cookie'] = TRUE;
$config['sess_use_database'] = TRUE;
$config['sess_table_name'] = 'wana_sessions';
$config['sess_match_ip'] = FALSE;
$config['sess_match_useragent'] = TRUE;
$config['sess_time_to_update'] = 300; 

I have searched the forums, but i can’t solve this problem
please solve this issue or suggest an alternative method.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T11:40:05+00:00Added an answer on June 12, 2026 at 11:40 am

    Try changing the reference to ‘gmt’ – in config.php

    $config['time_reference'] = 'gmt'; instead of $config['time_reference'] = 'local';

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have following route in route.php in codeigniter $route['^(?!login|signup|autos|jobs|jobwanted|admin).*'] = pages/bpages; it is redirecting
I am facing problems in flipping views in iPhone. I have two views in
I want to create multiple children using fork() , but I am facing problems.
I have created a Windows Forms C# application. But I am facing problems in
I am new to codeigniter and i am facing a small issue. I have
Hi I am facing a problem with hooks in Codeigniter.I have written hook for
I have been currently facing problems with creating surface controller in Umbraco 5.0.1 and
I have a small shopping cart I am writing, and currently am facing problems
Guyz facing problems with creating a push notification service (for android) using Google C2DM
I'm facing problems with the UTF-8 encoding on Heroku. I need to pass the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.