This code was working 4 weeks ago, i swear.

When i attempt a login, it goes through this script all the way to the
Header once a successful login as happened.  Everything in this code
block works correctly, except that the variables don't exist in the
session.  It's almost as if the "session_register()" function doesn't
work anymore.  Can anyone see what i'm doing wrong:




<?php
require_once 'dvd/common.php';

session_start();

if ($goahead) {
        if (!strlen($v_username))
                $loginError = "Please enter your username";
        else if (!strlen($v_password))
                $loginError = "Please enter your password";
        else { // ok to go
                $dbh = mysql_connect(DB_HOST, DB_USER, DB_PASS);
                mysql_select_db(DB_NAME);
                $username = strtolower($v_username);
                $query = "select password, access_level, first_name, last_name, email,
user_id from users where lower(login) = '$username'";
                $stmt = mysql_query($query, $dbh);
                $result = mysql_fetch_row($stmt);

                if (strcmp(md5($v_password),$result[0]) == 0) { // do passwords match?
                        $dvd_login = $v_username;
                        $dvd_access_level = $result[1];
                        $dvd_first_name = $result[2];
                        $dvd_last_name = $result[3];
                        $dvd_email = $result[4];
                        $dvd_id = $result[5];

                        if (session_register('dvd_login')) print 'Registered 
$dvd_login<br>'; 
                        else print 'Registration of $dvd_login Failure<br>';
                        
                        if (session_register('dvd_access_level')) print 'Registered
$dvd_access_level<br>'; 
                        else print 'Registration of $dvd_access_level Failure<br>';
                        
                        if (session_register('dvd_first_name')) print 'Registered
$dvd_first_name<br>'; 
                        else print 'Registration of $dvd_first_name Failure<br>';
                        
                        if (session_register('dvd_last_name')) print 'Registered
$dvd_last_name<br>'; 
                        else print 'Registration of $dvd_last_name Failure<br>';
                        
                        if (session_register('dvd_email')) print 'Registered 
$dvd_email<br>';
                        else print 'Registration of $dvd_email Failure<br>';
                        
                        if (session_register('dvd_id')) print 'Registered 
$dvd_id<br>'; 
                        else print 'Registration of $dvd_id Failure<br>';

                        print "$dvd_login, $dvd_access_level, $dvd_first_name,
$dvd_last_name, $dvd_email, $dvd_id ";
                        print "<Br> $query";
                        
                        if (isset($redirect))
                                print 'Header("Location: " . 
base64_decode($redirect));';
                        else
                                print 'Header("Location: /loggedIn.php");';

                        die;
                } else 
                        $loginError = "Unable to authenticate.<br>Please try again.";
                                                          
        }
}
?>

To test the session i use this script:  (nothing is showing up though).

<?php
session_start();

print '<Table border=1>';
print '<Tr><Td colspan=2><b>Session</b></Td></Tr>';
while (list($key,$val) = each($HTTP_SESSION_VARS)) {
        print "<Tr><Td align=right>$key</Td><Td align=left>$val</Td></Tr>\n";
}
print '</Table>';

?>

-- 
robin curts
senior programmer
[EMAIL PROTECTED]
/*--------------------*/
thoughtbubble productions, inc.
http://www.thoughtbubble.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to