Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/hatamiarash7/phonebook

Contact manager - PHP
https://github.com/hatamiarash7/phonebook

bootstrap contacts php php7

Last synced: 30 days ago
JSON representation

Contact manager - PHP

Awesome Lists containing this project

README

        

PHP-Login
=========

A simple, secure system with PHP, MySQL and jQuery (AJAX) using Bootstrap 3 for the form design a phone book.

## Installation
### Clone the Repository
$ git clone https://github.com/hatamiarash7/PhoneBook

### Creating the MySQL Database

Create database "login" and create tables "members" and "loginAttempts" and "contacts" :

```sql
CREATE TABLE IF NOT EXISTS contacts (
id INT(11) NOT NULL AUTO_INCREMENT,
unique_id VARCHAR(100) NOT NULL PRIMARY KEY,
fname VARCHAR(100) NOT NULL,
lname VARCHAR(100) NOT NULL,
phone_home VARCHAR(100) NULL,
phone_work VARCHAR(100) NULL,
phone_mobile VARCHAR(100) NULL,
job VARCHAR(100) NULL,
email VARCHAR(100) NULL,
address_work TEXT NULL,
address_home TEXT NULL,
birthday DATE NULL,
UNIQUE KEY unique_id (unique_id),
UNIQUE KEY email (email),
UNIQUE KEY id (id)
)
CHARACTER SET utf8
COLLATE utf8_unicode_ci;

CREATE TABLE `members` (
`id` CHAR(23) NOT NULL,
`username` VARCHAR(65) NOT NULL DEFAULT '',
`password` VARCHAR(65) NOT NULL DEFAULT '',
`email` VARCHAR(65) NOT NULL,
`verified` TINYINT(1) NOT NULL DEFAULT '0',
`mod_timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `username_UNIQUE` (`username`),
UNIQUE KEY `id_UNIQUE` (`id`),
UNIQUE KEY `email_UNIQUE` (`email`)
)
ENGINE = InnoDB
DEFAULT CHARSET = utf8;

CREATE TABLE `loginAttempts` (
`IP` VARCHAR(20) NOT NULL,
`Attempts` INT(11) NOT NULL,
`LastLogin` DATETIME NOT NULL,
`Username` VARCHAR(65) DEFAULT NULL,
`ID` INT(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`ID`)
)
ENGINE = InnoDB
DEFAULT CHARSET = utf8;
```
### Setup the `login/dbconf.php` file
```php
Read code comments for a description of each variable

```php
'.$signin_url.'';

//IGNORE CODE BELOW THIS
```
### Place this code (from `index.php`) at the head of each page :
> *** **Important** *** Checks to see if username $_SESSION variable is set. If not set, redirects to login page.

```php

```

### Check the Username and the Password using jQuery (Ajax) :

If the user has the right username and password, then the `checklogin.php` will send 'true', register the username and the password in a session, and redirect to `index.php`.
If the username and/or the password are wrong the `checklogin.php` will send "Wrong Username or Password".

### Signup/Login Workflow:
> 1) Create new user using `signup.php` form
> (note: validation occurs both client and server side)
>     Validation requires:
>        - Passwords to match and be at least 4 characters
>        - Valid email address
>        - Unique username
> 2) Password gets hashed and new GUID is generated for User ID
> 3) User gets added to database as unverified
> 4) Email is sent to user email (or $admin_email if set) with verification link
> 5) User (or admin) clicks verification link which sends them to `verifyuser.php` and verifies user in the database
> 6) Verified user may now log in