PhpGACL Chinese manual (11) usage use phpGACL basic usage in your application this example shows the basic usage of phpGACL in your program. It uses the ADOdb data abstraction layer and uses a simple phpGACL Chinese manual (11)
Use in your applicationPhpGACL
Basic usage
This example shows the basic usage of phpGACL in your program. It uses the ADOdb data abstraction layer and uses a simple method to ensure the legitimacy of database login.
// 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;
You can see that only the acl_check () function is called here. What does it do? It
- Check the ARO object from the ARO section "user" $ row ['name']
- Compare the ACO object "login" from the ACO section "system"
Advanced usage