Basic Clarification on Sessions(PHP4)
| From: | Mujahid Wazir | Date: | Wed, 17 Jan 2001 05:36:01 +0000 |
| Subject: | Basic Clarification on Sessions(PHP4) | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-5062@lists.php.net to get a copy of this message | ||
Hi,
I want to know if the sample implementation below of session variables is
correct.
I am going through the PHP4 Manual, but any clarification would be great
INDEX.PHP
<?
session_start();
$example = 1;
session_register("example") ;
?>
SOME OTHER PAGE
<?
session_start();
if (!isset($example)) {
Header("Location: Index.php") ;
} ?>
I tried using session_is_registered() instead of isset but I am getting
errors, probably because of incorrect syntax. All I want is to redirect the
user back to the main page if the session is not set. Can anyone please show
me the right way.
Thanks
-Mujahid