On Friday 09 April 2004 11:07, Jason Giangrande wrote:
Jason Wong wrote:
What does the php error have to say about it?
php error? I'm sorry but I don't know what you are talking about.
Sorry, I meant to say "php error log". You should ALWAYS enable full error reporting. And whenever you encounter a problem the first thing you should do is check the error log.
I do not have error logging enabled. All errors are displayed to the screen. This is not a production server I am testing on.
The only error I get is that a call to a member function on a non-object. Here's the error (path has been changed):
Fatal error: Call to a member function on a non-object in /path/to/php/script/test.php on line 16
And what code are you running to get that error? Because AFAICS the code you presented cannot produce that error.
I wasn't showing the method call, because it isn't what's causing the problem (well I don't think so, anyway). The problem is the session not unserializing for some reason. Here is the code.
Page one:
require_once('UserAuth.inc');
$auth = new UserAuth('file', array('file' => '/tmp/password'));
if (!empty($_POST['username']) && !empty($_POST['password'])) {
//$auth = new UserAuth('file', array('file' => '/tmp/password'));
if ($login = $auth->login($_POST['username'], $_POST['password'], $secret_word)) {
session_start();
$_SESSION['auth'] = serialize($auth);
//session_register("auth");
//var_dump($_SESSION['auth']);
header('Location: http://example/code/php/test.php');
//$auth->debug();
die();
} else {
var_dump($login);
echo 'Test failed!';
die();
}
}
<More code down here>
Page two:
require_once('UserAuth.inc');
session_start();
if (!empty($_SESSION['auth'])) { var_dump($_SESSION['auth']); $userauth = unserialize($_SESSION['auth']); //$auth = $_SESSION['auth']; var_dump($userauth); }
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<title>UserAuth Test</title>
</head>
<body>
<?php echo $vars; ?>
<a href="/admin/login.php?logout">Logout</a> </body> </html>
<?php } else { var_dump($vars); session_destroy(); }
-- Jason Giangrande <[EMAIL PROTECTED]> http://www.giangrande.org http://www.dogsiview.com
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php