flip posted on 2009-01-03 04:05:47 #
I have some trouble with session data (3 dimensional array in $_SESSION disappears), which is out of the scope of the forum but it led me to investigate how access user class is handling sessions.
I found that in the main class file access_user_class.php it checks if the constant USE_MYSQL_SESSIONS is defined. If not defined it does a session_start(). If defined it includes another file session_handler.php. One of the first (unconditional) statements in this file is session_start(). I fail to see the logic in this...
Does a mysql session mean that a php session should not be used ?
The most popular forum posts:
Comments / discussions
Olaf posted on 2009-01-03 08:33:29 #
This is only where the session is stored. Normally the session is stored in text files on the server. On some unsafe shared hosting accounts it could be possible to hijack these sessions.
Using a database is more safe. On some basic hosting accounts it's not allowed to use your "own" session handler.
so you problem with 3 dimensional arrays is not related to this item ;).
Maybe you should serialize the array data...
flip posted on 2009-01-03 14:56:54 #
So if i understand right.
With MYSQL you make the session also to have the user stay logged in. But the session data is stored in mysql.
I'm still a little confused, because i have enabled MYSQL sessions and there is still data from access user class inside the $_SESSION variable.
Also i'm wondering with MYSQL sessions enabled, can i still use $_SESSION like normal or is everything going into the mysql database?
Sorry to bother you about this, but on my test page without the class my 3D array is doing fine.
I will now try to disable MYSQL sessions to see if this will make things better.
P.S. i tried serialize to transform a 3D array into a 1D array with serialized 2D array, but this didn't solve my problem.
P.P.S. is normal session or mysql session faster?
Olaf posted on 2009-01-03 17:44:15 #
no not really ;)
a regular session creates a file with the session as name. Inside this file you find all the variable names and values (the array).
Using a mysql database for storage the data is stored inside a db record.
Everything else is the same! the included class (the session handler) takes care about the session updated/insert/delete handling.
it's possible that you get performance issues with a very busy website (1000 or more simultaneous sessions for example)
flip posted on 2009-01-05 01:22:50 #
My problem with the 3D session array is solved (work-around) now that i disabled MYSQL sessions. I am not on an unsafe shared host and performance seems the same.
I'm glad this problem is fixed now because i was thinking about it for a few days and i never expected the class to have something to do with it.
I don't know if your class is the cause, but the disable fixed my problem so there might be a bug in your class.