Home > Backend Development > PHP Tutorial > phpGACL汉语手册(十一)用法

phpGACL汉语手册(十一)用法

WBOY
Release: 2016-06-13 13:04:24
Original
1068 people have browsed it

phpGACL中文手册(十一)用法

在你的应用程序中使用 phpGACL

基本用法

这个实例展示了在你程序中使用 phpGACL 的基本用法。它使用了 ADOdb 数据抽象层,并且用一种简单的方式来确保登录数据库的合法性。

// include basic ACL api
include ('phpgacl/gacl.class.php ');
$gacl = new gacl();

$username = $db ->quote ($_POST ['username ']);
$password = $db ->quote (md5($_POST ['password ']));
$sql = 'SELECT name FROM users WHERE name= ';
$sql .= $username .' AND password= '.$password ;
$row = $db ->GetRow ($sql );
if ($gacl ->acl_check ('system ','login ','user ',$row ['name '])){
??? $_SESSION ['username '] = $row ['name '];
???? return true ;
}
else return false ;

你可以看到在这儿仅仅调用了 acl_check() 函数。它做了什么呢?它

  • ARO 节" user" 中检查 ARO 对象 $row['name']
  • ACO 节" system" 中对比 ACO 对象" login"

高级用法

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template