Login and Logout Using Session in PHP and MySQLi

Bipsmedium
2 min readMay 12, 2020

How to create login and logout using session in PHP and MySQLi

Now, we are going to perform the login and logout using session in PHP and MySQLi In order to perform, we need three files with .php extension.

1. login.php
2. home.php
3. logout.php

Here, we will not be doing registration for the users because I have covered this earlier. For the registration part, you can check How to insert HTML form data in MySQL database using PHP

Put these three files in a folder name session.

Before getting started with the login and logout operation, we will take a look briefly at the session.

Basic overview of the session in PHP | What is the session in PHP

A session is just a time duration of a user for the activities he performs on the web. For eg:-when a user opens Facebook and log in to view his Facebook profile and after completing the activities he logout. The time between login and log out is called a session.

How to use session in PHP

--

--

Bipsmedium

Hi, This is Biplab and I am a PHP laravel developer and other open source technologies. I am here to share my experience with the community.