How to fix the session_register() deprecated problem in PHP 5.3
Don't use it. The description says:
Register one or more global variables with the current session.
Two things that came to my mind:
$_SESSION['var'] = "value".See also the warnings from the manual:
If you want your script to work regardless of
register_globals, you need to instead use the$_SESSIONarray as$_SESSIONentries are automatically registered. If your script usessession_register(), it will not work in environments where the PHP directiveregister_globalsis disabled.
This is pretty important, because the register_globals directive is set to False by default!
Further:
This registers a
globalvariable. If you want to register a session variable from within a function, you need to make sure to make it global using theglobalkeyword or the$GLOBALS[]array, or use the special session arrays as noted below.
and
If you are using
$_SESSION(or$HTTP_SESSION_VARS), do not usesession_register(),session_is_registered(), andsession_unregister().
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With