turbo Posted March 15, 2007 Share Posted March 15, 2007 With PHP 5, the default setting for register globals is off! Sessions I used on my website suddenly stopped working with the upgrade to php 5. Was given the advice in quotes below ??? "If you want your script to work regardless of register_globals, you need to instead use the $_SESSION array as $_SESSION entries are automatically registered. If your script uses session_register(), it will not work in environments where the PHP directive register_globals is disabled." The code below does not work; <?php session_start( ); if( !isset( $_SESSION['count'] ) ) { $_SESSION['count'] = 0; } else { $_SESSION['count']++; } ?> How do i get it to worK?? Thanks Link to comment https://forums.phpfreaks.com/topic/42888-session-variables-dont-work-anymore/ Share on other sites More sharing options...
per1os Posted March 15, 2007 Share Posted March 15, 2007 Seems like it should work to me? But than again I have not worked in PHP5 maybe they changed the session data. Try looking at session_start() via php.net to see if they changed it for v5. Link to comment https://forums.phpfreaks.com/topic/42888-session-variables-dont-work-anymore/#findComment-208299 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.