melvincr Posted July 6, 2007 Share Posted July 6, 2007 i've a basic question if there is any reason not to store a userobject in a session.. $tempuser = new cl_user(); $tempuser->LoadById(1); $_SESSION['userobject'] = serialize($tempuser); i did this to avoid many sql accesses, the object itself contains all security functions like html stripping, size checks.. Quote Link to comment Share on other sites More sharing options...
per1os Posted July 6, 2007 Share Posted July 6, 2007 You don't even need to serialize it. Just make sure that the class definition comes before session_start() Quote Link to comment Share on other sites More sharing options...
melvincr Posted July 6, 2007 Author Share Posted July 6, 2007 the problem is that the object needs some session variables (language).. is there a reason not to serialize it? Quote Link to comment Share on other sites More sharing options...
per1os Posted July 6, 2007 Share Posted July 6, 2007 No, just stating that. As for the problem, thats not really a problem at all. I have classes I store in session that uses session variables for verification etc. Never had a problem with it, and I never serialized it. I guess I could but yea. Quote Link to comment Share on other sites More sharing options...
melvincr Posted July 6, 2007 Author Share Posted July 6, 2007 thx Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.