CodeIgniter Session Disappear Bug?

Apr 6, 2011

I am using CI 1.7.3 and here are my settings:

$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 0;
$config['sess_encrypt_cookie'] = FALSE;
$config['sess_use_database'] = TRUE;
$config['sess_table_name'] = 'sessions';
$config['sess_match_ip'] = FALSE;
$config['sess_match_useragent'] = TRUE;
$config['sess_time_to_update'] = 300;

I cannot come up with steps that cause the session to expire, it just seems random and is very frustrating for users.

View 1 Replies


Session Data Disappear When Using Sess_use_database In Codeigniter?

Im creating a authentication for my web (currently im using codeigniter as my php framework). How come when i set TRUE in the $config['sess_use_database'] = TRUE; my session data's disappears and doesn't display in part of the page. Im trying to display the username of the person who login to the site. When the $config['sess_use_database'] = FALSE; the username displays in the page. anyone experience this problem? how can i resolve this?

View 1 Replies

Subdomain Session Disappear?

if(!isset($_GET['n'])) {

This page index.php is used in a subdomain. The subdomain is a folder in the root domain,

View 1 Replies

Session Variables Disappear When Popup Window Closes

I am in window one (of one) and I popup a second window. Everything is fine. When the popup window closes the entire session in window one is destroyed!! I have tried everything from named sessions to caches, etc.. This does not happen when i start out with two windows open??

View 4 Replies

Session Variable Values Disappear With Additional POST Requests To Same URL?

It's been a while since I've needed to whip anything substantial up from scratch, so my scripting is a little (lot) fast and loose (weird/inefficient) here.

I'm trying to mock up a script that's essentially a quiz/survey. There are a handful of topics, each with a few screens of yes/no questions. At the end, it returns a list of recommendations based on the answers gathered.

The script is posting back to itself. Using print_r ($_SESSION), it seems like all of the post values for the first screen of questions are being assigned to the session array as expected. When the second screen of questions is answered, their values are assigned as well, but the values for the first set go away completely. This continues through subsequent screens, with the values from the previous screen present and all others before missing.

// database connect
$dbc = mysqli_connect($CFG->dbhost, $CFG->dbuser, $CFG->dbpass, $CFG->dbname);
// set to section 1, page 1 if no values are in _POST array


View 6 Replies

Codeigniter And Uploadify Session - Send Session Data As A Parameter With Uploading Request

when we use codeigniter session library. i know that flash doesn't forward browser cookies with its request. and i saw many solutions to send the session data as a parameter with uploading request. but it doesn't seems a real solutions for me.

View 1 Replies

Session Dies In CodeIgniter / Directly On The Server Causing The Session To Die?

I have an app built in CI and I would like that sessions don't die unless users close their browser. In my config file I have the following:

$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 0;
$config['sess_encrypt_cookie'] = FALSE;
$config['sess_use_database'] = FALSE;
$config['sess_table_name'] = 'ci_sessions';
$config['sess_match_ip'] = FALSE;
$config['sess_match_useragent'] = TRUE;
$config['sess_time_to_update'] = 0;

But session still dies after a period of time, is there any other configuration I need to do? Maybe directly on the server that might be causing the session to die?

View 1 Replies

Declaring Own Session Instead Of Session Maintained By Codeigniter?

Is there any way to define your own session instead of session maintained by codeigniter ?

View 2 Replies

Codeigniter Session Value As Images?

In my project,I am using pagination and I used these statements to get the page number detail

echo $this->session->userdata('page');

when I print this session value in that page itself, I got the value correctly.and when I click on the particular link and then print that data, I am getting the value like 'images'Why this is happened.But when i write the statements like :


View 1 Replies

Size Of Session In Codeigniter?

How do I increase the size of the session framework CodeIgniter? The standard size is 04 kb

View 3 Replies

Codeigniter Object In Session?

I'm writing this login page and I'd like to add the users object to the session. How do I do that? The user object comes from my user model.. For a new instance I write:

$this->load->model('user_model', 'user');

but this won't work:

$this->session->set_userdata('userobject', $this->user);

View 2 Replies

Which Session Library Should Use With CodeIgniter

I have recently started using CI and with it CI sessions, but I have noticed that one thing in particular is much more time consuming to do with CI sessions than with the base PHP sessions: Arrays. I have an array of data that persists regardless of login/logout called $_SESSION['stats'], I then store data in that array in the form:

$_SESSION['stats']['last_page'] = $_SERVER['REQUEST_URI'];.

And when a user logs out, it saves the stats array in a variable, clears the session, and then loads it back into the new session. The problem is that in order to edit the last_page key, instead of the one line above, I have to use this code:

$stats = $this->CI->session->userdata('stats');
$stats['last_page'] = $_SERVER["REQUEST_URI"];
$this->CI->session->set_userdata('stats', $stats);

This is one of a number of annoyances I find in CI sessions, which cause me to feel dissatisfied with it as my session handler. So my question is: Which session system should I use with CodeIgniter?... is there some reason for using CI sessions?

View 2 Replies

Session Update In Codeigniter?

would like to ask if it is possible to update the session data saved in the database in codeigniter,, for example. i have a session userdata(roleID,name,logged_in), so that when someone will login, ill just call the $data['name'] = $this->session->userdata('name'); and echo it in my header view as <?php echo $name; ?>,, the problem is when a user will update his firstname or lastname, and when i do this

$fname = $this->input->post('fname');
$lname = $this->input->post('lname');

View 1 Replies

Codeigniter: User Session Keeps Expiring

I'm using CodeIgniter, and I'm having a small issue with sessions. I've set 'sess_expiration' in config.php to 0 so that the user session will never expire, yet users -even myself- are still occasionally kicked out and asked to login again! (i'm storing sessions in the DB btw)

The way I validate a user's session is by basically checking if user_id (which I've previously stored in the session is TRUE or FALSE. If it's FALSE then it asks them to login again.

View 1 Replies

Codeigniter - Finding A Session Library?

I have been using the CodeIgniter system for a while now - but it has it's short comings. I am grateful for what it taught me, but now I need a library for a new non-codeigniter project and so I am looking around for on which libraries have things right and which don't. I will probably have to take pieces from several libraries to get everything I need.

I just took a look a the Kohana PHP session library and I like how it returns to the native PHP way of using the $_SESSION superglobal instead of forcing a change to $this->session for data access. At any rate, I wanted to know if there were other good session libraries out there I might be messing. There is a lot that must be handled in a session besides just CRUD functionally.

Support for NON-cookie based session passing (i.e. Facebook or Flash uploaders) "Flash data" that only lasts for the next page load and then is auto-removed. Works with $_SESSION or $this->session so that programmers don't have to change existing code. Supports setting a new session id (i.e. session_id('new id')) in case you want to change the id mid-way through the page. Saves all data at the end of the page request instead of each time data is added or removed (saves extra DB queries).


View 3 Replies

CodeIgniter Session Object Cannot Be Found?

I'm working on a model that tracks user data and stores it in a session, where appropriate. Here's the basic structure of it:

public function __construct() {


View 1 Replies

CodeIgniter Session Cookie Domain?

It appears with the following cookie settings below, that cookies are set for the entire domain. For example if I was on [URL]... the cookie would be set for if I was on the cookie would be set for [URL]... If the cookie is set for that does that mean cannot access a cookie from [URL]...


View 1 Replies

MySQL Query In CodeIgniter With Session ID?

Let's say I have a query:

" SELECT * FROM table
WHERE donor_id = " .$this->session->userdata('id') ."
GROUP BY rating"

However, it appears that I get a mysql syntax error here, citing that $this->session->userdata('id') gives me '25' for example, instead of 25. Are there any workarounds here to prevent $this->session->userdata('id') from being quoted?

View 3 Replies

Jquery Uploadify And Codeigniter Session Id

The problem is the same. No session id is being passed which causes a lot of problems. This is my config.php :-

$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 2700;
$config['sess_encrypt_cookie'] = FALSE;
$config['sess_use_database'] = FALSE;
$config['sess_table_name'] = 'ci_sessions';

As you can see i have already set sess_match_useragent to false but still my session ids are getting changed. Can anybody tell me how do i pass my session ids in scriptData? Because Codeigniter doesn't use querystring approach instead it builds up pretty urls.

View 1 Replies

Multiple Session Instances Codeigniter?

So I have an app built using Codeigniter and we are experiencing some trouble when a session is loaded and someone loads another URL that would start a session with the same app. The problem is that the second session is overwriting the initial session (at least partially) and corrupting the data being sent.We are using database sessions and encryption.

View 1 Replies

Codeigniter's Native Session Class?

so I switched my application over to the Native Session Class is codeigniter due to some problems with IE and sessions. However now, this session class seems to be logging people out very quickly. I have gone over all the code and can't seem to find the problem. Here's the native session class: [URL]...Also all my config vars are the default setting. I am wondering if this is Native Session's fault or my own. I do use a bool var in another script that is used to determined whether the user is logged in. Just thought I'd throw this out there. BTW, Codeigniter 1.7.3, PHP 5

View 2 Replies

CodeIgniter Loop Through Session User_Data?

I am trying to create a method that return's an array of all CodeIgniter user_data for use in my library.I cant seem to figure it out... is it possible loop through all CI session userdata and create another array?

private function load_session()
$session = array();

View 1 Replies

CodeIgniter Session And Flash Uploaders?

I'm trying to solve the problem of session data getting lost when using any flash uploader (uploadify or SWFupload) with CodeIgniter. I have tried by passing the session_id and start session using the old session_id, even then I can not get the data stored in session. Therefore I would like to request if you know any solution of this problem or can recommend me some session library to use instead of codeigniter session library,

View 2 Replies

Codeigniter Check For User Session In Every Controller?

I have this private session in one of my controllers that checks if a user is logged in:

function _is_logged_in() {
$user = $this->session->userdata('user_data');
if (!isset($user)) { return false; } else { return true; }
Problem is that I have more than one Controller.How can I use this function in those other controllers?Redefining the function in every Controller isn't very 'DRY'.

View 2 Replies

Codeigniter: Storing Users Role In Session?

Is it safe to store the user's role in Codeigniter's session? The role will determine what function the user will have; that is being a admin, a regular subscriber, or a premium user. I am also storing the session in a database for additional security, but I would like to know if I should use a alternate route, such as querying the user's id and checking their role but I believe that just taking it one step further in authentication.

View 2 Replies

Codeigniter Session Data Not Available In Other Pages After Login?

So, I have set up a login page that verifies the user's credentials, and then sets codeigniter session data 'email' and 'is_logged_in' and a few other items. The first page after the login, the data is accessible. After that page, I can no longer access the session data. In fact, if I try reloading that first page, the session data is gone.I have tried storing it in the database, storing it unencrypted (bad idea I know, but it was for troubleshooting), and storing it encrypted. I have autoloaded the session library in config.php. Here's an example of the code I'm using to set the session data:

$data = array(
'email' => $this->input->post('username'),
'is_logged_in' => true


View 3 Replies

Copyrights 2005-15, All rights reserved