芝麻web文件管理V1.00
";
}
class Auth_Log_Observer extends Log_observer {
var $messages = array();
function notify($event) {
$this->messages[] = $event;
}
}
$options = array(
'enableLogging' => true,
array(
'type' => 'Array',
'options' => array(
'cryptType' => 'md5',
'users' => array(
'guest' => md5('password'),
),
),
),
array(
'type' => 'Array',
'options' => array(
'cryptType' => 'md5',
'users' => array(
'admin' => md5('password'),
),
),
),
);
$a = new Auth("Multiple", $options, "loginFunction");
$infoObserver = new Auth_Log_Observer(AUTH_LOG_INFO);
$a->attachLogObserver($infoObserver);
$debugObserver = new Auth_Log_Observer(AUTH_LOG_DEBUG);
$a->attachLogObserver($debugObserver);
$a->start();
if ($a->checkAuth()) {
/*
* The output of your site goes here.
*/
print "Authentication Successful.
";
}
print 'Logging Output:
'
.'AUTH_LOG_INFO level messages:
';
foreach ($infoObserver->messages as $event) {
print $event['priority'].': '.$event['message'].'
';
}
print '
'
.'AUTH_LOG_DEBUG level messages:
';
foreach ($debugObserver->messages as $event) {
print $event['priority'].': '.$event['message'].'
';
}
print '
';
?>