学习pear的LiveUser
pear ini_set("display_errors", true);
require_once("conf.php");
require_once("login.php");
page_top();
if (!$LU->isLoggedIn()) {
echo 'Login';
show_login();
} else {
echo 'LiveUser Example';
echo 'Logout';
show_user_info($LU);
echo '--------------------------------------------------------------------------------';
require_once('eve_rights.php');
echo 'Events';
if (!$LU->checkRight(EVE_VIEW)) {
echo 'You are not authorized to view events';
} else {
echo 'You are authorized to view events';
} }
page_bottom();
function show_user_info($LU) { echo 'Welcome ' . $LU->getProperty('handle') . '!';
echo 'Here is the contents of the "liveuser_users" table:';
echo ''; echo ' auth_user_id: ' . $LU->getProperty('auth_user_id') . '';
echo ' handle: ' . $LU->getProperty('handle') . '';
echo ' passwd: ' . $LU->getProperty('passwd') . '';
echo ' owner_user_id: ' . $LU->getProperty('owner_user_id') . '';
echo ' owner_group_id: ' . $LU->getProperty('owner_group_id') . '';
echo ' lastlogin: ' . date('d.m.Y H:i', $LU->getProperty('lastlogin')) . '';
echo ' is_active: ' . $LU->getProperty('is_active') . '';
echo ' email: ' . $LU->getProperty('email') . '';
echo ''; }
require_once("conf.php");
require_once("login.php");
page_top();
if (!$LU->isLoggedIn()) {
echo 'Login';
show_login();
} else {
echo 'LiveUser Example';
echo 'Logout';
show_user_info($LU);
echo '--------------------------------------------------------------------------------';
require_once('eve_rights.php');
echo 'Events';
if (!$LU->checkRight(EVE_VIEW)) {
echo 'You are not authorized to view events';
} else {
echo 'You are authorized to view events';
} }
page_bottom();
function show_user_info($LU) { echo 'Welcome ' . $LU->getProperty('handle') . '!';
echo 'Here is the contents of the "liveuser_users" table:';
echo ''; echo ' auth_user_id: ' . $LU->getProperty('auth_user_id') . '';
echo ' handle: ' . $LU->getProperty('handle') . '';
echo ' passwd: ' . $LU->getProperty('passwd') . '';
echo ' owner_user_id: ' . $LU->getProperty('owner_user_id') . '';
echo ' owner_group_id: ' . $LU->getProperty('owner_group_id') . '';
echo ' lastlogin: ' . date('d.m.Y H:i', $LU->getProperty('lastlogin')) . '';
echo ' is_active: ' . $LU->getProperty('is_active') . '';
echo ' email: ' . $LU->getProperty('email') . '';
echo ''; }