Welcome Guest, Not a member yet? Register   Sign In
Losing session in Firefox when redirect to other page
#1

Hi all,

I use CI Lib. session to do  the login function. It is always lost when I go to other page

Note that it happens just in Firefox (using FF38.0.5). In Chrome is ok

This is my configuration:

Code:
$config['sess_driver'] = 'files';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 7200;
$config['sess_save_path'] = FCPATH.'ci_sessions';
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE;

and loaded in every Controller:

Code:
$this->load->library('session');
$this->load->driver('session');

I changed config to database as:
Code:
$config['sess_driver'] = 'database';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 7200;
$config['sess_save_path'] = 'ci_sessions';
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE;

and make the data as:
Code:
CREATE TABLE IF NOT EXISTS `ci_sessions` (
       `id` varchar(40) NOT NULL,
       `ip_address` varchar(45) NOT NULL,
       `timestamp` int(10) unsigned DEFAULT 0 NOT NULL,
       `data` blob NOT NULL,
       PRIMARY KEY (id),
       KEY `ci_sessions_timestamp` (`timestamp`)
);

still same problem.

Anyone help!!??

Thanks so much
Reply
#2

I had a problem with firefox logins and sessions too a while ago and although I cannot recall the exact solution I am sure one of the things I did was to remove the underscores from the cookie names. I hope that helps :=)
Reply
#3

(06-22-2015, 05:55 PM)PaulD Wrote: I had a problem with firefox logins and sessions too a while ago and although I cannot recall the exact solution I am sure one of the things I did was to remove the underscores from the cookie names. I hope that helps :=)

That couldn't possibly help, not in the way you think it does. If it does, it's not because of the underscores, but because of a collision and changing the cookie name in any way would "help".
Reply
#4

(06-18-2015, 12:59 AM)nnanh01 Wrote: and loaded in every Controller:


Code:
$this->load->library('session');
$this->load->driver('session');

You should only need
Code:
$this->load->library('session');
The driver will be loaded based on the configuration.
Reply
#5

(06-26-2015, 01:18 PM)mwhitney Wrote: You should only need
Code:
$this->load->library('session');
The driver will be loaded based on the configuration.

Thanks for all your replies.

Thank mwhitney, I did, but it was not help, too.

Any suggestion??
Reply
#6

How do you call the page eg. Ajax?
Someone on the IRC had the same problem (12 days ago).

Problem was the ajax request. The request was from a other domain. Problem called Same origin policy

https://en.wikipedia.org/wiki/Same-origin_policy

Solution
http://caniuse.com/#feat=cors
http://stackoverflow.com/questions/35062...71#9523871

header("Access-Control-Allow-Origin: http://foo.example"); in the Controller. http://foo.example is the ajax site. Smile
Reply




Theme © iAndrew 2016 - Forum software by © MyBB