Code

Simple PHP Login System

Simple PHP Login System

About

“Brilliant, simple and secure” – Buyer
This simple PHP login system is formed to be easily implemented into any new or current existing website to allow webmasters/owners to give their users an area to login, be able to restrict their pages from anonymous visitors, or display custom content based on the user. Please take note that this system does not include any other systems like user registration, user management, or content management, this only establishes a connection/session to your website with login credentials, however still allows access to query your database, and pull any information you choose to store in there.

To make it easy for developers and non-developers alike, I went ahead and created a setup file included in the package which will allow you to easily set up the system with your MySQL database.

Requirements

  • MySQL database (5.x)
  • PHP (5.4)

Features

  • Simple and secure PHP PDO, OOP script
  • MySQL database-driven, to hold user information
  • Easy to implement with any new or current websites
  • Secure from common SQL Injection, and XSS attacks
  • Usage of the whirlpool hashing algorithm (512-bit digest) to secure user passwords safely in your database, however you may change the algorithm to whichever you use or to not use one at all

File Structure

php-login-system/
  • class/
  • config.php/ (holds the MySQL database connection information)
  • global.php/ (the PHP class that makes the system)
  • css/
  • bootstrap.min.css/ (styling from the free Twitter Bootstrap 3 package)
  • sql/
  • users.sql (stock/backup SQL dump file for a basic user structure)
  • _setup.php/ (for setting up your MySQL database)
  • index.php/ (demo/example of login)
  • readme.html/ (documentation on usage)

Version 0.2 – (8/27/2014)

  • Refactored code to use PDO for all database operations

Version 0.3 – (12/30/2016)

  • Fixed issue with setup page
  • Cleaned up some code
by
by
by
by
by
by