A simple login form using Ajax, PDO and PHP session
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
css
js
php
README.md
index.php

README.md

#Ajax Login form This is a work-in-progress simple login form built with Ajax, PDO and PHP session. jQuery is used for the Ajax requests and Bootstrap is used for styling.

##Installation

  • Clone the repo: $ git clone https://github.com/JompaGlitter/ajax-login-form
  • Add database connection details in the top of php/login.php
  • Create database table users if it doesn't exist and create columns id and name within.
  • Create database table passwords if it doesn't exist and create columns id, user_id and password within.
  • Store some user names and passwords and you're good to go.

###Important: The database connection will request the password based on the user id of the supplied name if the name is valid. Therefore make sure that users.id matches passwords.user_id when storing user information, otherwise the request will fail.

##Note The database connection is built with PDO and uses the PDO::prepare() and PDO::execute() to protect against SQL injection attacks. In this case though the password is assumed to be stored in plain text which of course is not optimal or secure at all. A better way to do it is to use password_hash on the plain text password and the password_verify for verification when logging in.