Skip to content
This repository has been archived by the owner on Mar 15, 2018. It is now read-only.

TheCJGCJG/PHP-Login

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 

Repository files navigation

PHP Login Class

This is a basic PHP login class for authenticating users through a MySQL Database.

  • Usernames
  • Hashed & Salted Passwords

Usage

//Initialize the class 
require_once 'login.php';
$login = new login("127.0.0.1", "web_login", "TotallySecurePassword", "webSite_Storage", "3306", "storage_")

//Create user Hello with the password of World
$login->createAccount('Hello', 'World');

//Check an account password
if ($login->checkPassword('Hello', 'World')) { 
    //Password is correct
} else {
    //Password is incorrect
}

Functions

  • Initialize
/**
* Initialisation is done when instantiating the class like so
*/
$login = new login("127.0.0.1", "web_login", "TotallySecurePassword", "webSite_Storage", "3306", "storage_")
  • Create A User Account
$login->createAccount(string $username, string $password);

/*
* Returns true on success, returns false on error
*/
  • Delete a User Account
$login->deleteAccount(string $username);

/*
* Returns true on success, returns false on error
*/
  • Change a User Account Password
$login->changePassword(string $username, string $password);

/*
* Returns true on success, returns false on failiure.
*/
  • User Permissions
//TO BE COMPLETED
  • Password Checking
$login->checkPassword(string $username, string $password);

/*
* Returns true on correct password, returns false on incorrect password
*/

About

A basic PHP login and authentication class.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages