PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
What is wrong with the snippet you posted (other than the fact it only returns an integer value)? What specifically are you trying to glean from your session data?
You're gonna have to fork that snippet to open the folder and read from it. This may not give you exactly what you want because, and I couild be wrong here, PHP serializes session data when it is stored. You may end up having to not only get the information, but unserialize it and figure out what is actually in each array value of the unserialized session data strings.
Have you thought of databasing your sessions to allow for easier, and in my opinion, faster, access to session user data?
Everah wrote:You're gonna have to fork that snippet to open the folder and read from it. This may not give you exactly what you want because, and I couild be wrong here, PHP serializes session data when it is stored. You may end up having to not only get the information, but unserialize it and figure out what is actually in each array value of the unserialized session data strings.
Have you thought of databasing your sessions to allow for easier, and in my opinion, faster, access to session user data?
Yes, they are serialized... here is an example of a session file:
Thanks for the input! I'll look into unserializing the data first. Barring that, I'll explore
the database option, which is something I have been wanting to do for my site as part
of a revamping project anyway.
Thanks for the suggestions, guys. Here is the final code for my instant gratification solution.
It's a little messy, but works fine for my immediate purposes. I'm definitely going to build
in the database session management stuff at some point when I have some free development
time to spare.