I have a function that checks to see if a user has an active session and
if so I'd like it to return the value of a variable (the variable
$username). However, when I var_dump the variable it's value is NULL.
Anyone know why? Here's the function:
function auth_user($logged_in) {
if (isset($logged_in)) {
list($s_username, $hash) = explode(',',$logged_in);
global $secret_word;
if (md5($s_username.$secret_word) == $hash) {
$username = $s_username;
return $username;
} else {
die ("You have tampered with your session.");
}
} else {
die ("Sorry, you are not logged in. Please log in and try again.");
}
}
Here's the code that calls the function which is in another script.
auth_user($_SESSION['login']);
var_dump($username);
Thanks,
Jason Giangrande
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php