PHP Classes

Auth Class: Manage accounts and authenticate users

Recommend this page to a friend!

  Author Author  
Picture of Cuonic
Name: Cuonic <contact>
Classes: 2 packages by
Country: France France
Age: 36
All time rank: 106737 in France France
Week rank: 703 Up26 in France France Up


  Detailed description   Download Download .zip .tar.gz   Install with Composer Install with Composer  
This class can manage accounts and authenticate users.

It can perform several types of operations to manage the records of users stored in a MySQL database (accessed using the MySQLi extension) like creating user accounts, activate accounts, change the user e-mail address or the password, and remove accounts.

The class can also authenticate an user with a given password, create user sessions, delete sessions, get the session information, check if the session is valid, manage failed login attempts.

Details
User Authentication PHP Class ============================= This is a simple user authentication class for PHP, which uses a MySQL Database which is accessed via MySQLi. The system also includes a Custom user session system, meaning sessions can last a predefined time, for example, 1 minute to over 10 years if that was ever needed. The Current functions are as follows : - login($username, $password) : Verifies user credentials - register($username, $password, $verifypassword, $email) : Adds a new user account to the database - newsession($username) : Creates a new session for the user - deletesession($hash) : Deletes an existing session from the database, and removes the user's cookie - sessioninfo($hash) : Retrieves info about the session from database (UID, Username, Expire Date, IP) - checksession($hash) : Checks if session is valid - randomkey($length) : Returns a random key, used as activation key, contain lowercase / uppercase letters and numbers - activate($username, $key) : Activates an account based on username and activation key - changepass($username, $currpass, $newpass, $verifynewpass) : Changes the user's password. Requires current password - changeemail($username, $email) : Changes the user's email - resetpass($username, $email, $key, $newpass, $verifynewpass) : Sends reset request email and resets user's password - checkresetkey($username, $key) : Checks the reset key based on username, returns true / false - deleteaccount($username, $password) : Deletes the user's account. Requires current password - addattempt($ip) : Logs a new attempt of authentication based on user IP - getattempt($ip) : Retrieves amount of attempts from database based on user IP - expireattempt() : Removes expired attempt logs from database, should be ran as cron job - LogActivity($username, $action, $additionalinfo) : Logs the user's usage of the class, from login to logout. Includes attempts. - hashpassword($password) : Hashes the password with the following : hash("SHA512", base64_encode(str_rot13(hash("SHA512", str_rot13($auth_conf['salt_1'] . $password . $auth_conf['salt_2']))))) The extended encryption will result in a pratically uncrackable password. The session system relies on the user's IP, if it changes, the user will have to reauthenticate. Database layout is stored in auth.sql which you can import easily with PhpMyAdmin Auth configuration is done in config.php where you can configure the MySQL database settings, attempts settings, email settings etc...

  Classes of Cuonic  >  Auth Class  >  Download Download .zip .tar.gz  >  Support forum Support forum (3)  >  Blog Blog  >  RSS 1.0 feed RSS 2.0 feed Latest changes  
Name: Auth Class
Base name: authclass
Description: Manage accounts and authenticate users
Version: 1.0.0
PHP version: 5.0
License: GNU General Public License (GPL)
All time users: 2121 users
All time rank: 1847
Week users: 0 users
Week rank: 148 Equal
 
  Groups   Screenshots Screenshots   Rate classes User ratings  
  Applications   Related pages   Files Files  

  Groups  
Group folder image PHP 5 Classes using PHP 5 specific features View top rated classes
Group folder image Databases Database management, accessing and searching View top rated classes
Group folder image User Management User records, authentication and session handling View top rated classes

  Files folder image Screenshots  
auth.cuonic.tk.png
File Role Description
Accessible without login Image file auth.cuonic.tk.png Screen Screenshot of example usage


  User ratings  
RatingsUtility Consistency Documentation Examples Tests Videos Overall Rank
All time: Good (80%) Good (80%) Sufficient (65%) - - - Not sure (54%) 1953
Month: Not yet rated by the users

  Applications that use this package  
A quick demo of the class that I set up

Add link image If you know an application of this package, send a message to the author to add a link here.


  Related pages  
The Github repository for this class, updated more than PHPClasses project

  Files folder image Files  
File Role Description
Accessible without login Plain text file auth.class.php Class The PHP Auth Class
Accessible without login Plain text file auth.sql Data The MySQL Database Structure
Accessible without login Plain text file config.php Conf. Auth Configuration file
Accessible without login Plain text file lang.php Aux. Language file
Accessible without login Plain text file README Doc. Some Basic class info

Install with Composer Install with Composer - Download Download all files: authclass.tar.gz authclass.zip
NOTICE: if you are using a download manager program like 'GetRight', please Login before trying to download this archive.
  Files folder image Files  
File Role Description
Accessible without login Plain text file auth.class.php Class The PHP Auth Class
Accessible without login Plain text file auth.sql Data The MySQL Database Structure
Accessible without login Plain text file config.php Conf. Auth Configuration file
Accessible without login Plain text file lang.php Aux. Language file
Accessible without login Plain text file README Doc. Some Basic class info

Install with Composer Install with Composer - Download Download all files: authclass.tar.gz authclass.zip
NOTICE: if you are using a download manager program like 'GetRight', please Login before trying to download this archive.