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.. Link to comment https://forums.phpfreaks.com/topic/58729-solved-question-about-object-sessions/ 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() Link to comment https://forums.phpfreaks.com/topic/58729-solved-question-about-object-sessions/#findComment-291334 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? Link to comment https://forums.phpfreaks.com/topic/58729-solved-question-about-object-sessions/#findComment-291350 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. Link to comment https://forums.phpfreaks.com/topic/58729-solved-question-about-object-sessions/#findComment-291358 Share on other sites More sharing options...
melvincr Posted July 6, 2007 Author Share Posted July 6, 2007 thx Link to comment https://forums.phpfreaks.com/topic/58729-solved-question-about-object-sessions/#findComment-291646 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.