User Registration System Using PHP and MySQL Database


In this Article, I'll provide you all information which you need to creating a user registration system where users can create an account by providing username, email and password. Also after registration user can Login and logout by their username which user used for registration.

I will also show you how you can make page accessible only to logged in users. Any other user not logged in will not be able to access that page. For this i'm going to use session of PHP

SOURCE CODE DOWNLOAD


For Demo & Source Code Scroll down, Before download go through from this article for proper installation.

Quick Start, you need these files to start work on this:

  • 1. Download and unzip into a folder
  • 2. Create a database and import the users.sql file
  • 3. Change the database settings in server.php to your own
  • 4. Run index.php

STEP 1
THE DATABASE


After downloading source code file for this. You will find users.sql file. That file, contains all information about database to be needed for this.

        
CREATE TABLE `users` (
    `id` int(11) NOT NULL,
    `username` varchar(50) NOT NULL,
    `email` varchar(50) NOT NULL,
    `password` varchar(50) NOT NULL
    ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
        
    

After installing database, your database should be look like this

STEP 2
THE PROCESS


Here, I'm going to elaborate how to use files after downloading them.

# In server.php

First, you need to configure database according to your server. After this process you can start further process. Below is the code to connect database.

            
// connect to the database
$db = mysqli_connect('localhost', 'root', '', 'registration');
            
        

After these changes you are set to run index.php in localhost server such as xampp or wampp

if you face any issues you can contact by asking question on Developers Community

Do You have Ready Project?

Share It With Others. Submit Your Project & get Featured On Our Website.

Share

Share


More Great Articles