Welcome Guest, Not a member yet? Register   Sign In
Problem with CI Session
#1

[eluser]Arres[/eluser]
My project's session which is built on CI has suddenly stopped working.

However session is working fine on firefox but not working on chrome and internet explorer 10.

I tried two things which I found online

1. in config changing the ci_sessions to cisessions
2. by commenting the $this->sess_update(); in Session class.


Nothing worked.

I've found this problem with many people before but none of answer is satisfactory.

I tried setting variable and print all values.

below is what i got in firefox
Code:
Array ( [session_id] => 8890abe9ceb778147657afa4fc23af67 [ip_address] => 116.71.176.32 [user_agent] => Mozilla/5.0 (Windows NT 6.1; rv:18.0) Gecko/20100101 Firefox/18.0 [last_activity] => 1361500845 [user_data] => [uid] => 19 [name] => Arslan Afzal [status] => org [photo] => brad41.jpg [membership] => 1 )

and below is what i got in chrome by same operation
Code:
Array ( [session_id] => e4a0eabc6d77606d1bbb9de96e4bb5f3 [ip_address] => 116.71.176.32 [user_agent] => Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.57 Safari/537.17 [last_activity] => 1361499903 [user_data] => )

my variables
[uid] => 19 [name] => Arslan Afzal [status] => org [photo] => brad41.jpg [membership] => 1
are gone in chrome and also in internet explorer.
Please help!
#2

[eluser]boltsabre[/eluser]
- What version of CI are you running?
- Have you the latest session table structure as outlined in the user documentation here: http://ellislab.com/codeigniter/user-gui...sions.html
- On the above point, the biggest problem is not having the "ip_address" column at 45 chars.
- Do you have cookies disabled in chrome/IE? Looks like you're getting something into the session, so I doubt that that is it, but worth checking anyway.
- Are you running http, or https? (if https are you 200% that every asset is loaded with https, including external scripts, images, etc?) Sometimes conflicts between http / https can cause strange behaviours.
- Are you trying to set the session in a normal php standard way, or is it part of an ajax request?

If you cannot find the problem I suggest you start putting some echo / debugging statements into the core sessions library and find out exactly where it it is failing in chrome/IE, this will help you to narrow down what the problem is / where it is happening.
#3

[eluser]Arres[/eluser]
Thank you for reply.
It's CI version 2.1.3

The problem is quit complex.

I'm not using database for session.

The ip address is correct as I know my ip address is that.

I'm running http.

I'm sending username and password in ajax request and it it setting session if details are correct.


The point is, the project was working great early yesterday. Everything on every browser was fine.
I made some changes and and got this problem.

But as i keep copy of each day work, I uploaded the 1 day old version. and that was working before, but not working now.

It is not working on chrome/internet explorer 10/safari
But it is working fine on firefox.

Moreover, The big thing. It is working fine on all browsers at my localhost but not working on server at above mentioned browser.
Please help!
#4

[eluser]sandeepkhokher[/eluser]
Are you facing this issue while making a AJAX request ??

Because I got something similar but very weird too..
#5

[eluser]LuckyFella73[/eluser]
How did you set the cookie settings in application/config/config.php ?

Try like this maybe:
Code:
$config['cookie_prefix'] = "yourprefix";
$config['cookie_domain'] = ($_SERVER['SERVER_NAME'] == 'localhost' ? '' : preg_replace('/^www\./', '', $_SERVER['SERVER_NAME']));
$config['cookie_path']  = "/";
$config['cookie_secure'] = FALSE;

Then it should work generelly on localhost and on your productive server.
#6

[eluser]Arres[/eluser]
Thank LuckyFella73 but it didn't work, even it was giving error that config file not properly formed.

Even a weird thing is that i was even unable to login to http://ellislab.com/forums using Chrome. Every time i put login info, it was saying i logged in successfully and then redirect to forum, and I see that I'm not logged in.

But I got the solution.

I uninstalled chrome. and reinstalled a fresh copy. It's working fine now.
I hope it will also work on other browsers fine too.
If not i will update the thread.

Between here i still did not understood the problem, If you can tell me problem you think it was then i will appreciate it.

Thank you all guys!




Theme © iAndrew 2016 - Forum software by © MyBB