Welcome Guest, Not a member yet? Register   Sign In
CodeIgnitor is generating multiple sessions in the database?
#1

[eluser]Derrick24[/eluser]
Ive got a site that does a few ajax calls on page load, now for some reason, codeIgnitor is inserting 4 sessions (I'm assuming for each ajax call) as you load the page. I'm storing the sessions in the database.

I'm pretty sure there should only be one session per browser? FF seems to only generate one, other browsers seem to create four and there are four ajax calls?

(Also its not multiple users, as the ip address is all the same.)

any ideas?
#2

[eluser]pistolPete[/eluser]
Do the session entries differ in some way?
Try disabling sess_match_useragent.
Also have a look at this thread: http://ellislab.com/forums/viewthread/123432/
#3

[eluser]Derrick24[/eluser]
Below are the entries created as you enter the site:

Code:
'4453d4d7076685b4f780e5b30c03f467', '41.213.115.35', 'Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) Ap', 1268495676, ''
'733a38818bcde757e69b3386d81f650d', '41.213.115.35', 'Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) Ap', 1268495676, ''
'737b77fe42182d95013bac1480153909', '41.213.115.35', 'Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) Ap', 1268495676, ''
'dcb76a039bec27f7c8ba289f35400a2a', '41.213.115.35', 'Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) Ap', 1268495676, ''

Pretty much identical.
#4

[eluser]Derrick24[/eluser]
Ive tried various setting incl, disabling match user agent -> I still get multiple sessions for the same user.
#5

[eluser]renownedmedia[/eluser]
This solved the same issue for me: http://ellislab.com/forums/viewthread/138823/
#6

[eluser]Derrick24[/eluser]
Hi, thanks for the help. That solution does not seem to work for me. Im not new to php or CI so Im pretty sure Ive done it correctly.

BUT besides that -> Ive also just discovered that every time I refresh the page I get a new session ID inserted into the database (That cant be correct?)
#7

[eluser]jasongodoy[/eluser]
[quote author="Derrick24" date="1268567384"]Hi, thanks for the help. That solution does not seem to work for me. Im not new to php or CI so Im pretty sure Ive done it correctly.

BUT besides that -> Ive also just discovered that every time I refresh the page I get a new session ID inserted into the database (That cant be correct?)[/quote]

Derrick - did you ever find a solution for your problem? I am having the same issue. I simply autoloaded the Session library on a new clean installation of CI and setup a sessions database as per the user guide instructions. Now every page I navigate to on my simple site creates a new session record in my MySQL database. I thought that a session record would only be created in the db only after logging in, not on every page view. Is this the way sessions are supposed to work? Please help!

Thanks

J
#8

[eluser]Derrick24[/eluser]
No - I did not find a solution, Ive resorted to using php's session handlers directly.
#9

[eluser]bimtee[/eluser]
change $config['sess_expiration'] = 7200; to $config['sess_expiration'] = 86400;




Theme © iAndrew 2016 - Forum software by © MyBB