CodeIgniter Session Disappear Bug?

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.


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 View Related

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 View Related

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 View Related

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 View Related

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 View Related

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 View Related

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 View Related

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 View Related

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 View Related

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 View Related

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 View Related

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 View Related

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 View Related

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 View Related

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 View Related

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 View Related

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 View Related

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 View Related

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 View Related

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 View Related

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 View Related

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 View Related

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 View Related

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 View Related

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 View Related

CodeIgniter Session Issue On Opera And Safari?

I am using codeigniter 1.7.2.In my web app after logging out, on clicking the back button of the browser the page is reloaded in the logged in page.This issue is occuring on Opera and Safari only.I have disabled cache using meta, but that doesn't help.

<meta http-equiv="PRAGMA" content="NO-STORE" />
<meta http-equiv="Expires" content="-1" />
<meta http-equiv="CACHE-CONTROL" content="NO-STORE" />


View 2 Replies View Related

Codeigniter - Storing Database Results In Session?

i want to store some session info from a database query, upon log in,but for some reason it isnt letting me set the session userdata!?!Can anyone shed any light as to why?Controller:

function validate_login(){
$this->form_validation->set_rules('email_address', "Email address","required|valid_email");


View 3 Replies View Related

Safe Timeout Value For Codeigniter Session Class?

I am using codeigniter's session class to handle my PHP sessions. One of the session variables automatically created on every visit to the site is session_id:

The user's unique Session ID (this is a statistically random string with very strong entropy, hashed with MD5 for portability, and regenerated (by default) every five minutes)

On my site I need to have functionality to track unregistered user's and I currently have this implemented by comparing the visitor's session_id with a stored id value in a VISITOR table in the database. This works perfectly except for the fact that the session id times out every five minutes. I would like my application to remember visitors for longer than 5 minutes (kind of like what SO does when you post a question or answer without registering).

My question is this: can you see any security issues with simply extending the regeneration time of the session class (to something like 12 hours)?

Update: based on the answers I've seen so far, it seems like its more of a performance concern rather than a safety issue. Its kinda weird how the codeigniter session class works because when creating a new session, it also creates a new cookie which seems to persist as long as the session. I guess I could create another cookie with the session ID that lasts as long as I need it to. But how much of a performance concern would it be if I were to save the sessions for something like 12 hours? Would it slow things down unless I have millions of unique visitors within a 12 hour period (

View 3 Replies View Related

How CodeIgniter Keeps Session Data Even When Browser Closes

I wonder how does the session work in CodeIgniter. Isn't the session suppose to be automatically destried when the browser is closed? The CodeIgniter does not destroy the session on browser close by default:

$config['sess_expire_on_close'] = FALSE;

Instead we can set the session expire time: $config['sess_expiration'] = 7200;

Now for example if I set the expiration time to 0, it will keep the session as long as I do not destroy by myself: $this->session->sess_destroy(); So how does the CodeIgniter keeps the session information for specific time, even after the browser is closed? Also, is it secure if use this default setting(of not expiring the session with browser close) to keep user login for few days? (eg. store in session 'logged_in' => TRUE )

View 1 Replies View Related

Codeigniter Create Session And Redirect Not Working In IE?

I'm using codeigniter and have a simple user login setup.User submits their credentials, checks with the DB if they are valid, if they are the model passes the controller a session ID and is redirected to the user page. If the data is not correct the user is redirected to the login page with an error message. Nothing fancy here. The problems is it doesnt work in IE. I'm not sure if its because of the redirect or the session creation. Works fine in all browsers except IE. I tested ie 8 with windows 7 on parallels and worked fine. The weird thing is that it doesnt work with on a pc with windows 7 IE 8. Can someone tell me why the login page just keeps getting refreshed every time the user goes to login? I was told to try and add this code :

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="Expires" content="-1" />
<meta http-equiv="CACHE-CONTROL" content="NO-CACHE" />

Which did nothing. I also changed the session handler from ci_sessions to cisessions which didnt help either (i saw this on another forum).

View 2 Replies View Related

Copyrights 2005-15, All rights reserved