note 26464 deleted from function.session-is-registered by googleguy

From: Date: Tue, 22 Oct 2013 09:04:49 +0000
Subject: note 26464 deleted from function.session-is-registered by googleguy
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-196887@lists.php.net to get a copy of this message
Note Submitter: somedude at wholikesphp dot com ---- Just to elaborate for those who may be having some problems. If you're using a newer version of PHP that comes with the register globals directive set to "off", you should heed the caution at the top of these notes. It's easier anyway. Instead of using session_register(...) , simply use somethig like: <? //must always start the session first session_start(); //in place of session register(..) use...like someone said above $_SESSION['VARNAME'] = $something // or "something"; /* then on the same page or subsequent pages where you want check for the session use something like.... and on another page where the session hasn't been started you have to call session_start(); first, if the session has already been started you don't need to call it again */ session_start(); //instead of session_is_registered(); if(isset($_SESSION['VARNAME'])) { print("What you want if the session var is set"); } else { print("What you want if the sessions variable is not set"); } ?> I hope this helps someone! If you want to learn more about $_SESSION and/or it's related "superglobals" try http://www.php.net/manual/en/printwn/language.variables.predefined.php good road!

« previous php.notes (#196887) next »