Recommend this page to a friend! |
Download |
Info | Example | Files | Install with Composer | Download | Reputation | Support forum | Blog | Links |
Ratings | Unique User Downloads | Download Rankings | ||||
72% | Total: 1,253 | All time: 3,056 This week: 42 |
Version | License | PHP version | Categories | |||
oz-user 1.2 | GNU General Publi... | 5 | PHP 5, User Management |
Description | Author | |
This class can register, login and recover users in a database. |
What is the best PHP login class?
Login class with forgot password, register, login
<?php |
Universal class for basic user routine. Class definition for your project purpose is required.
Class provides: - user database routine (select / insert / update / delete) - user account routine (login / logout / recover / check)
Probably the best way is to use the ideas of methods realization in your own class.
PHP Tested: 5.6.19, 7.0.11
1. CLASS DEFINITION
2. PUBLIC METHODS
2.1. User::init()
2.2. User::getByID()
2.3. User::getByLogin()
2.4. User::getList()
2.5. User::add()
2.6. User::update()
2.7. User::delete()
2.8. User::loginUpdate()
2.9. User::loginExists()
2.10. User::passwordHash()
2.11. User::passwordCheck()
2.12. User::passwordUpdate()
2.13. User::passwordGet()
2.14. User::login()
2.15. User::logout()
2.16. User::recover()
2.17. User::check()
2.18. User::getError()
Class definition is provided in $_definition variable:
private static $_definition = array(
'table' => 'users', /users table name/
'id' => 'userID', /user identifier field name/
'login' => 'login', /user login field name/
'pass' => 'password', /user password field name/
'key' => 'session_key', /user session key field name/
'fields' => array('group', 'name', 'mail') /add your fields here/
);
Initialization of class. Should be called before other methods.
$db_drvr - database driver.
$db_host - database server.
$db_host - database name.
$db_user - database user.
$db_pass - database password.
Get user data (except password) by ID.
To get hash of user password use User::passwordGet() method (see section 2.13).
Get user data (except password) by login.
To get hash of user password use User::passwordGet() method (see section 2.13).
It's good idea to use chache here.
Get users list.
Add new user.
$data - user data array with keys according definition.
Password should be provided as is. Method will create hash and write it into database.
Update user data (except login and password).
$data - user data array with keys according definition. Some data could be skipped.
To update login use User::loginUpdate() method (see section 2.8).
To update password use User::passwordUpdate() method (see section 2.12).
Delete user by ID.
Update user login.
Check if $login exists in database. User with $userID skipped.
Create user password hash using random seed.
Check user password.
Update user password. Password should be provided as is. Method will create hash and write it into database.
Get user password hash from database.
Login user in system.
Logout user.
Create new password and update database.
Check current user.
Return list of latest errors as array.
Files (21) |
File | Role | Description | ||
---|---|---|---|---|
examples (6 files, 1 directory) | ||||
LICENSE | Lic. | License | ||
README.md | Doc. | Documentation | ||
user.class.php | Class | User class |
Files (21) | / | examples |
File | Role | Description | ||
---|---|---|---|---|
bootstrap (3 directories) | ||||
account.php | Example | Account demo | ||
login.php | Example | Login demo | ||
logout.php | Example | Logout demo | ||
recover.php | Example | Recover demo | ||
registration.php | Example | Registration demo | ||
users.sql | Data | Test sql user table dump |
Files (21) | / | examples | / | bootstrap | / | css |
File | Role | Description |
---|---|---|
bootstrap-theme.css | Data | Bootstrap |
bootstrap-theme.css.map | Data | Bootstrap |
bootstrap-theme.min.css | Data | Bootstrap |
bootstrap-theme.min.css.map | Data | Bootstrap |
bootstrap.css | Data | Bootstrap |
bootstrap.css.map | Data | Bootstrap |
bootstrap.min.css | Data | Bootstrap |
bootstrap.min.css.map | Data | Bootstrap |
Files (21) | / | examples | / | bootstrap | / | fonts |
File | Role | Description |
---|---|---|
glyphicons-halflings-regular.svg | Data | Bootstrap |
Files (21) | / | examples | / | bootstrap | / | js |
File | Role | Description |
---|---|---|
bootstrap.js | Data | Bootstrap |
bootstrap.min.js | Data | Bootstrap |
npm.js | Data | Bootstrap |
The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page. |
Install with Composer |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
User Ratings | User Comments (2) | |||||||||||||||||||||||||||||||
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.