原来的笔记-用LiveUser来处理登录认证
2008-05-11 10:50
507 查看
用LiveUser来处理登录认证
Posted 三月 9th, 2007 by stone5pear
require_once("conf.php");
require_once("login.php");
page_top();//显示页头
if (!$LU->isLoggedIn())//是否登录
{
echo 'Login';
show_login();//显示登录表单界面
}
else
{
echo 'LiveUser Example';//下面显示登录用户的各个属性而已
echo 'Logout';
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('passwd') . '
';
echo '
email: ' . $LU->getProperty('email') . '
';
echo '
';
}
page_bottom();
?>
//login.php的文件内容
<?php
function page_top()
{
echo '';
echo '';
echo '';
}
function page_bottom()
{
echo '';
}
function show_login()
{
ini_set("include_path", '../../libs/PEAR/' . PATH_SEPARATOR . ini_get("include_path"));
require_once ("HTML/QuickForm.php");//用了QuickForm包
echo 'Please log in to access this page';
$form =& new HTML_Quickform('logon', 'post');
$renderer =& $form->defaultRenderer();//用这个来构QuickForm包的模板,偶还是暂时不清楚
$renderer->setElementTemplate('
{label}
(*)
{error}
{element}');
$note='(*) Mandatory';
$form->setRequiredNote($note);//不解,下次在QuickForm中学
$form->addElement('text', 'handle', 'Userid', array('class'=>'text'));//有了上面的模板,这边增加元素就好了,呵呵
$form->addRule('handle', 'Userid is mandatory', 'required');
$form->addElement('password', 'passwd', 'Password', array('class'=>'text'));
$form->addRule('passwd','Password is mandatory', 'required');
$form->registerRule('check_pswd', 'callback', 'is_pswd_ok', $form);
$form->addRule('passwd', 'Logon failed', 'check_pswd');
$form->addElement('advcheckbox', 'rememberMe', '', ' Remember me',
array('class'=>'text'), array(false,true));
$form->addElement('submit', 'btnSubmit', 'Login');
if (!$form->validate())
{
$form->display();
}
}
function is_pswd_ok(&$passwd)
{
$LU->login($LU->getProperty('handle'),$LU->getProperty('passwd'));//处理登录的过程呀
if ($LU->isLoggedIn())
{
return true;
}
else
{
return false;
}
}
相关文章推荐
- 原来的笔记--学习pear的LiveUser
- 原来的笔记-pear live user最难理解的conf.php的内容
- 笔记01 登录、常用配置参数、Action访问Servlet API 和设置Action中对象的值、命名空间和乱码处理、Action中包含多个方法如何调用
- [AHK]华泰证券的委托认证和用户登录窗口的自动处理
- 关于登录SQL Server 原来的数据库及创建的user消失,重启电脑后恢复的原因 推荐
- CVP认证学习笔记--李天宇013在Node的生命周期和图层种处理触摸
- Sharepoint学习笔记---如何在Sharepoint2010网站中整合Crystal Report水晶报表(报表登录处理)
- 结合WAS简析J2EE规范中的登录认证和非规范中的注销以及通过filter增加自定义处理过程
- [Ubuntu] 利用Ubuntu光盘破解win7用户登录 -- Crark the win7 user via Ubuntu live CD
- Spring-Security笔记8 在页面和后台中获取登录的user
- java鬼混笔记:shiro 1、基本ini配置文件的登录认证
- java鬼混笔记:shiro 6、shiro和spring整合、数据库方式认证登录
- 关于mysql的用户管理,笔记 1、创建新用户 通过root用户登录之后创建 >> grant all privileges on *.* to testuser@localh
- UsernamePasswordAuthenticationFilter 登录认证
- userinit.exe丢失导致不能登录系统问题处理 推荐
- struts2 笔记01 登录、常用配置参数、Action访问Servlet API 和设置Action中对象的值、命名空间和乱码处理、Action中包含多个方法如何调用
- MaNGOS-Zero源码学习之realmd认证登录服务器(二):socket的处理方式
- mysql登录报错“Access denied for user 'root'@'localhost' (using password: YES”的处理方法
- SQL2005 "user" islock 用户不能正常登录的处理方法
- laravel5.2.22 自带用户登录认证笔记