Jump to content

Session variables don't work anymore


turbo

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.