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
-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Reply via email to