Coder Social home page Coder Social logo

register-page's Introduction

Signup and login pages

This repository contains signup and login pages in PHP which use MySQL database.

Setup

To use this, copy contents of src folder to your web server root (assuming you have LAMP, WAMP or MAMP setup. if not, do it first.)

You have to create a MySQL user named 'user' and password 'password' (which you can change in php files in src)

To do this, run mysql server in a command line shell and enter following SQL:

CREATE USER 'user'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* TO 'user'@'localhost';
FLUSH PRIVILEGES;

You also have to create a database named login and a table named list by entering following SQL commands:

CREATE DATABASE login;
USE login;
CREATE TABLE list (
    id int not null auto_increment,
    user_name varchar(255) not null,
    first_name varchar(255) not null,
    last_name varchar(255) not null,
    email varchar(255) not null,
    password varchar(255) not null,
    PRIMARY KEY (id)
);

About

The directory src contains 3 PHP files:

  • signup.php
  • login.php
  • success.php

signup.php returns a html form to user and on submit, validates it using regular expressions. It then connects to mysql server and checks for duplicate username or email and finally inserts entry for new user in database, starts a new session by initializing session variables and takes to success.php.

login php returns a form to client and on submitting, fetches data from database by username and compares passwords and if passwords match, starts a new session and takes to success.php.

success.php greets user and retains user session started in signup.php or login.php. If user clicks logout, current session is destroyed and user is taken to login.php. If session variables are not set or username in session variables is not in database or password doesn't match, this page redirects to login.php and so, this page can't be accessed without logging in with valid details.

Also, these scripts use prepared SQL statements preventing SQL injection. The HTML forms in these pages also contain some basic CSS style.

Screenshots

Following are few screenshots of these pages.

screenshot screenshot screenshot screenshot screenshot screenshot screenshot


The code is not clean, but good enough (I guess). ๐Ÿ˜

You can add it to your server or website, and do anything you want, like improve style or appearance, improve code add new features etc. ๐Ÿ‘

Thanks ~ @deadfrominside ๐Ÿ˜„

register-page's People

Contributors

abhinav-yadav-official avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.