PHP Login, Logout and Registration System with Sample Code
Login, Logout and Registration system is an essential features for any web application. This is simple PHP based application that I will describe with sample PHP code. You can add this common application in your PHP project. This tutorial is for beginners, and also it is very easy to understand. So first of all take a look at the contents that you should learn throughout this brief tutorial.
PHP Login, Logout and Registration Tutorial:
- Introduction
- Basic Requirements
- Creating MySQL Database
- MySQL Database Connection using PHP
- Database Selection and Closing
- Some Fundamental SQL Query
- Creating HTML Layout using Twitter Bootstrap
- Creating Registration Form and Login Form
- Handling Registration Form using PHP
- PHP Login and Logout Handling
- Consolidating All Parts
- Conclusion
Introduction:
Using this application a user can be a registered member through a registration form. Only each registered member can enter into the application. After Login a member can be logged out into the system then if he or she wants to enter the system, he or she must be login the system by writing username and password in the login form. So we have to create registration form and login form for our users. We will create these by using Twitter Bootstrap form tutorial.
Want to know more on Twitter Bootstrap just go to this link: Twitter Bootstrap
So to develop this PHP Login, Logout and Registration application we need some basic requirements.
firstName,
lastName,
emailAddress,
userName and
password
The users table will be like this user(firstName, lastName, emailAddress, userName, password). We have defined the user table attributes but we have to create this table in MySQL database by writing hand made sql query or through PHPMyAdmin panel. In this portion we will create user table through PHPMyAdmin panel. Here's the steps you can follow:
Step 1: In your browser type http://localhost/phpmyadmin/ and then write username, password, and then click login(To do this at first you have to start your Vertrigo database otherwise you will not be able to enter this URL). It will show a screen and from this screen click on Databases. It will be look like this:
Important: We use Vertrigo server so the username is root and password is vertrigo.
Basic Requirements:
It is PHP and MySQL based web application so before making this cool application you have to meet some basic requirements. Lets see these...- A PHP and MySQL enable server like XAMPP or WAMP or Vertrigo. We use Vertrigo. To install Vertrigo in your PC, you can see this tutorial. How to install Vertrigo in your PC
- Basic Knowledge on HTML and JavaScript
- An editor like Dreamweaver or Notepad++ but we will use Dreamweaver editor.
Creating MySQL Database:
We will store the users information in MySQL database. Before that we have to create a MySQL database for our application. Suppose our database name is LoginSystem. This is our database name and we will use this for our application. Information's are stored in MySQL database as a Table. So for our each user we need to create a table. We can name this table user. What are the users information?? It is:firstName,
lastName,
emailAddress,
userName and
password
The users table will be like this user(firstName, lastName, emailAddress, userName, password). We have defined the user table attributes but we have to create this table in MySQL database by writing hand made sql query or through PHPMyAdmin panel. In this portion we will create user table through PHPMyAdmin panel. Here's the steps you can follow:
Step 1: In your browser type http://localhost/phpmyadmin/ and then write username, password, and then click login(To do this at first you have to start your Vertrigo database otherwise you will not be able to enter this URL). It will show a screen and from this screen click on Databases. It will be look like this:
Important: We use Vertrigo server so the username is root and password is vertrigo.
Step 2:
Then click create like the following picture.
Now you have completed your primary tasks and it's time to go forward.
Step 3:
Our database is created but we have to create a table for storing the users information. Our user has five attributes so make sure the table column is five and then click on create table. A new window will be open. In this window fill up the users information like this.
Now you have completed your primary tasks and it's time to go forward.
Step 3:
Our database is created but we have to create a table for storing the users information. Our user has five attributes so make sure the table column is five and then click on create table. A new window will be open. In this window fill up the users information like this.
We put each attributes type is verchar to make this application database simple. If you want to know more on Database you can read tutorial from the internet.
Select the username as a primary key and then click save button.
So we have created our fully functional database. Watch this portion in Youtube. Here is the link: PHP Login, Logout and Registration database Creation.
MySQL Database Connection using PHP: I will write this portion in next week.
Comments
Post a Comment