Session not Registering

From: Date: Thu, 21 Nov 2002 03:02:07 +0000
Subject: Session not Registering
Groups: php.general 
Request: Send a blank email to php-general+get-125370@lists.php.net to get a copy of this message
I have a PHP script that logs someone in then takes them to another page indicating their online status. However, when I try echoing out the contents of the session variable, it says this: Notice: Undefined variable: _SESSION in c:\program files\apache group\apache\htdocs\checker\members\index.php on line 38 Here's the code that registers the variable, or is atleast supposed to: if ($dbconn) { $querystr = "SELECT user FROM users WHERE (user = '" . prepareData($_POST['user']) . "' and pass=PASSWORD('" . prepareData($_POST['pass']) . "'))"; $result = mysql_query($querystr,$dbconn); if ($result) { if ($frow = mysql_fetch_row($result)) { session_start(); session_register('user'); $_SESSION['user'] = $frow[0]; header("Location: index.php?" . SID); exit(); } else { $error = "Invalid username and password combo."; } } Here's where I echo it out: <div align="left" class="log"><font size="2">Logged in as <?php echo $_SESSION['user']; ?></font></div> Any ideas why it's not working? Thanks, Stephen Craton http://www.melchior.us "Life is a gift from God. Wasting it is like destroying a gift you got from the person you love most." -- http://www.melchior.us

« previous php.general (#125370) next »