Emesh Posted May 4, 2011 Share Posted May 4, 2011 I've recently had a problem with my admin site where PHP sessions, which are stored in a MySQL database, are duplicating and causing the page to return to the login screen. Usually the site works fine in Firefox, but stops working in IE and Safari. This problem suddenly appeared over night with no change to the files. Due to the amount of code, I'm reluctant to post it all, but does anyone have a suggestion on why this could be happening and how to solve it? Quote Link to comment https://forums.phpfreaks.com/topic/235532-php-session-duplication/ Share on other sites More sharing options...
vicodin Posted May 5, 2011 Share Posted May 5, 2011 Honestly without looking at the code its literally just guessing... you need to write some functions to debug your code. Like start building functions that make you an error log. Quote Link to comment https://forums.phpfreaks.com/topic/235532-php-session-duplication/#findComment-1210731 Share on other sites More sharing options...
Emesh Posted May 7, 2011 Author Share Posted May 7, 2011 I found the cause, being <!DOCTYPE html> I'm not sure how or why its doing it though... Quote Link to comment https://forums.phpfreaks.com/topic/235532-php-session-duplication/#findComment-1211959 Share on other sites More sharing options...
wildteen88 Posted May 7, 2011 Share Posted May 7, 2011 <!DOCTYPE html> has nothing to do with PHP. As you're using sessions I guess you have written your own session handler for saving your sessions to the database. When you call session_start() to create a session make sure you calling that function before any html has been sent to the web browser. If you call it after html has been sent session will no longer work. Quote Link to comment https://forums.phpfreaks.com/topic/235532-php-session-duplication/#findComment-1211978 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.