Create a PHP Login with PDO Connection

In this article, we going to see how to create a simple PHP login with PDO connection. PHP Data Object is shortly known as PDO, using PDO you can do more secure applications because it is SQL injection free. So using session concept you going to see the login system. All the application required the login authentication this will help to increase your application more secure, so using this simple login script you can manage your application with secure.

The following code will fetch the username and password from the database table. Once you entered the username and password this will check the given data from the input and the given data is match with the database records then you get authenticate to the suceess.php page, suppose if you entered wrong data this will show you an error message “Please enter valid username and password”. The main advantage is a session, by using session if the variable expired then it will automatically logout you from the success.php page.

Database
index.php
success.php
logout.php

Below here you can download the source code and try user self, also you have the option to see the live demo.

Username: mraj
Password: admin

Preview & Download

 

Was this article helpful?

Yes No
×

How can we improve it?

×

We appreciate your helpul feedback!

Your answer will be used to improve our content. The more feedback you give us, the better our pages can be.

Follow us on social media:

Facebook Pinterest

Mraj

Creative Designer & Developer specialist by the spirit and a loving blogger by thoughts.

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top

DON’T MISS ANY UPDATE

Get notified about the next update

Pin It on Pinterest