/oop-pdo-login

Simple login system using PHP PDO in an OOP fashion.

Primary LanguagePHPOtherNOASSERTION

Login system using PHP

Specifications:

  • PDO MySQL Database connection
  • OOP user and session creation
  • Salted password hashes

Database creation SQL

Creating a new database in your MySQL

You can either do this through the phpMyadmin GUI or run this SQL:

CREATE DATABASE

Creating the table

This SQL:

  • Creates a primary key column named user_id that auto increments
  • Creates a username column that can't be empty and must be unique
  • Creates a password hash column of ength 60. This is because the BCRYPY algorhythm returns length 60 values

The SQL code:

CREATE TABLE users (
user_id int(11) NOT NULL auto_increment PRIMARY KEY,
username varchar(20) NOT NULL UNIQUE KEY,
password char(60) NOT NULL
);