Provides various official and user-released code examples. For code reference, you are welcome to learn about saveAccessList dump ($ _ SESSION) in RBAC.
Array (size = 5)
'Code' => string '75c084449d4e710f45f1bfac493aeaea '(length = 32)
'Username' => string 'xiao5' (length = 5)
'Id' => string '10' (length = 2)
'Authid' => string '10' (length = 2)
'_ ACCESS_LIST' =>
Array (size = 1)
'Home' =>
Array (size = 2)
'Rbac '=>
Array (size = 2)
...
'Article' =>
Array (size = 1)
...
Public function checkLogin (){
$ Username = $ _ POST ['username'];
$ Password = md5 ($ _ POST ['Password']);
$ Code = $ _ POST ['code'];
If ($ _ POST ['code']! ==$ Code ){
$ This-> error ('the verification code is incorrect! ', U ('login/Index '));
}
$ User = M ('user ');
$ Where ['username'] = $ username;
$ Where ['Password'] = $ password;
$ Arr = $ user-> where ($ where)-> find ();
If ($ arr ){
$ _ SESSION ['username'] = $ username;
$ _ SESSION ['id'] = $ arr ['id'];
$ _ SESSION [C ('user _ AUTH_KEY ')] = $ arr ['id'];
If ($ _ SESSION ['username'] = C ('rbac _ SUPERADMN ')){
$ _ SESSION [C ('admn _ AUTH_KEY ')] = true;
}
Import ('org. Util. RBAC ');
RBAC: saveAccessList ();
// Dump ($ _ SESSION );
$ This-> success ('user logon succeeded ', U ('index/Index '));
} Else {
$ This-> error ('account or password is incorrect! ', U ('login/Index '));
}
}
'Rbac _ superadmin' => 'admin', // super Administrator name
'Admin _ AUTH_KEY '=> 'superadmin', // super administrator identification
'User _ AUTH_ON '=> true, // whether to enable verification
'User _ AUTH_TYPE '=> 1, // verification type (1 logon verification 2 Real-time verification)
'User _ AUTH_KEY '=> 'authid', // USER ID
'Not _ AUTH_MODULE '=> 'index', // The authentication module is NOT required.
// 'Not _ AUTH_ACTION '=> '', // action method without verification
'User _ AUTH_MODEL '=> 'user ',
'Rbac _ ROLE_TABLE '=> 'tp _ role', // role table name
'Rbac _ USER_TABLE '=> 'tp _ role_user', // role and user's intermediate table name
'Rbac _ ACCESS_TABLE '=> 'tp _ access', // permission table name
'Rbac _ NODE_TABLE '=> 'tp _ node', // node table name
Qq image 201408011502.16.jpg (83.94 KB download: 13 times)
AD: truly free, domain name + VM + enterprise mailbox = 0 RMB