Simple Login and Registration System Using PHP

A simple login system is really very important for any website. Even websites like Facebook use this system to manage their users. Today In this article, we will talk about How can you create a login and registration system in your project or website Using PHP and MySQL Database in the easiest way. So, without further talking, let’s get started.

If you’re in hurry, you can download the source code instead

1 – Create A Login Form

In order to let users log in to your website, you need to provide them a login form. That’s why the primary element that we required is the login form. We can quickly create a login form using some basic HTML code. You can copy and paste the code below into your index.html file

2 – Create A Register Form

We have a login page now. But a user is required to create an account before he can log in. So, let’s just create another form for users to register. You can copy the HTML code below and paste this into the register.html file.

3. Create home.php file

Now we have pages for users to login and register. All we need right now is a home page for users after they successfully log in or register. To do that create a home.html file and copy-paste the HTML code below.

4. Add some styles

Urgh, what are those pages without any styles? Looking like blank pages. Let’s add some CSS (Cascading Style Sheets) to add some cool neumorphic design to our pages. It’s very simple to do. Just create a file called style.css and copy-paste the CSS codes below.

After adding this CSS file, your forms should look like the image below. Now you can spot the difference.

Neumarphic Form Design
Neumarphic Form Design

5 – Create a Database

If you are currently working on a project and want to create this user login and registration system. Then just simply replace “your_database_name” with your current database name below and run the SQL command below.

Or if you’re starting a new project, I would suggest you to create a new database and replace “your_database_name” with your newly created database name.

Note: You can also save this code below as an .sql file and import that to your database. In this case, remove “`your_database_name`.” from the command.

6 – Create process.php file

Congratulations! You’ve done so far. This is the last step to complete your project so far. Now you have to create one more last file call process.php

This file will process all your login, register and logout functionality. So, without further talking, create that file and copy past the PHP code below!

That’s it! Your Simple Login and Registration System is ready to use in production.

Please Note:

This is a very basic login system. To get the most customizable login system, I would recommend you to download this project. It’s easy to use, highly customizable, and can be used with any projects.

MD Khokon Mia

Full Stack Web Developer and Co-Founder Of Blog Desire. Love to code anytime.

Leave a Reply