| 5 | | * Parameters: |
| 6 | | * hash_method - hash type used for passwords, see <http://php.net/hash_algos> |
| 7 | | * salt_pattern - character offsets to place the random salt at |
| | 7 | * In order to log a user in, a user must have the `login` role. You may create |
| | 8 | * and assign any other role to your users. |
| | 9 | * |
| | 10 | * Database table schemas: |
| | 11 | * <code sql> |
| | 12 | * CREATE TABLE IF NOT EXISTS `users` ( |
| | 13 | * `id` int(11) unsigned NOT NULL auto_increment, |
| | 14 | * `email` varchar(127) NOT NULL, |
| | 15 | * `username` varchar(32) NOT NULL default '', |
| | 16 | * `password` char(50) NOT NULL, |
| | 17 | * `logins` int(10) unsigned NOT NULL default '0', |
| | 18 | * PRIMARY KEY (`id`), |
| | 19 | * UNIQUE KEY `uniq_username` (`username`), |
| | 20 | * UNIQUE KEY `uniq_email` (`email`) |
| | 21 | * ) ENGINE=MyISAM DEFAULT CHARSET=utf8; |
| | 22 | * |
| | 23 | * CREATE TABLE IF NOT EXISTS `roles` ( |
| | 24 | * `id` int(11) unsigned NOT NULL auto_increment, |
| | 25 | * `name` varchar(32) NOT NULL, |
| | 26 | * `description` varchar(255) NOT NULL, |
| | 27 | * PRIMARY KEY (`id`), |
| | 28 | * UNIQUE KEY `uniq_name` (`name`) |
| | 29 | * ) ENGINE=MyISAM DEFAULT CHARSET=utf8; |
| | 30 | * |
| | 31 | * INSERT INTO `roles` (`id`, `name`, `description`) VALUES (1, 'login', 'Login access privileges'); |
| | 32 | * |
| | 33 | * CREATE TABLE IF NOT EXISTS `users_roles` ( |
| | 34 | * `user_id` int(10) unsigned NOT NULL, |
| | 35 | * `role_id` int(10) unsigned NOT NULL, |
| | 36 | * PRIMARY KEY (`user_id`,`role_id`) |
| | 37 | * ) ENGINE=MyISAM DEFAULT CHARSET=utf8; |
| | 38 | * </code> |
| 9 | | $config = array |
| 10 | | ( |
| 11 | | 'user_table' => 'users', |
| 12 | | 'role_table' => 'roles', |
| 13 | | 'hash_method' => 'sha1', |
| 14 | | 'salt_pattern' => '1, 3, 5, 9, 14, 15, 20, 21, 28, 30' |
| 15 | | ); |
| | 40 | |
| | 41 | /** |
| | 42 | * Type of hash to use for passwords. Any algorithm supported by the hash function |
| | 43 | * can be used here. Note that the length of your password is determined by the |
| | 44 | * hash type + the number of salt characters. |
| | 45 | * @see http://php.net/hash |
| | 46 | * @see http://php.net/hash_algos |
| | 47 | */ |
| | 48 | $config['hash_method'] = 'sha1'; |
| | 49 | |
| | 50 | /** |
| | 51 | * Defines the hash offsets to |
| | 52 | */ |
| | 53 | $config['salt_pattern'] = '1, 3, 5, 9, 14, 15, 20, 21, 28, 30'; |