I am trying to use sessions on my site. When a person logs in , I retrieve his userid from the Db and try to assign that value to the session variable. The code on the first file goes like this :
<?
session_start();
session_register('userid');
?>
------ check and retrieve the user id from db---------
$GLOBAL['userid'] = $entry["userid"];
// (also used $HTTP_SESSION_VARS['userid'] = $entry["userid"])
echo "<script>window.location=\"xyz.php4\"</script>";
In the file xyz.php4 the code goes like this :
<?
session_start();
if (isset($HTTP_SESSION_VARS['userid']))
// (also used isset($_SESSION['userid']))
{
?>
----------execute the page---------
<?
}
else echo "you are not authorized to view";
?>
On the xyz.php4 page it always enters else part displaying 'you are not authorised'.....
NOTE: The php version is 4.0.5
In the php.ini file
Session Support is 'enabled'
register_globals is 'On'
Any help ??? 🙁
Thanks !!!