How To Create Login Page In php With Database

Last updated on Aug 30, 2016

Milan Sanathara

Php

2

How To Create Login Page In PHP With Database?

In the previous blog, We have learnt about hashing in PHP.Now,In this blog, we will focus on How to create login page in PHP with Database?

This blog will teach you the complete authentication mechanism using hashing in Php. Php Hashing Blog

In this blog we will cover up following topics :

  • Register User.
  • Login & Logout.
  • User Profile.
  • Edit Profile.
  • Delete Account.

First, create a database.And then create a table.

Create dbconnect.php

Create user-dbop.php for database operation

 

Create register.php

Add following PHP code in register.php to of the page

In above file, you can see the initconfig.php file.

What is initconfig.php?

initconfig.php is a custom created a file ,which sets the root path of the server according to the current server.

if you don’t want to set global root path then your register.php code should be like following.No need to create initconfig.php

When user registers, check user-dbop.php file ,The insert function hash the password ,entered by the user and then stores it in the database.

index.php Login screen

When user login, check user-dbop.php file ,The login function hash the password ,and then check with respect to database stored password .

Create profile.php

Create update-profile.php

delete_acc.php

logout.php

See Live Demo & Download Code

[sociallocker]

See the live Demo

Download the complete source code

[/sociallocker]

I hope you will find this post very useful regarding How To Create Login Page In PHP With Database. Let me know any questions if you have in comment regarding Php. I will reply you ASAP.

Have you got a cool idea about Web Application development? Contact us Now to get a free consultation on your idea. Alphanso Tech is rated as one of the best Web Development Company in India.

Post by Milan Sanathara

I am iOS Application Developer with an aspiration of learning new technology and creating a bright future in Information Technology.

2 Responses to How To Create Login Page In php With Database

    • Hello invaderb , It may due to data-table or path issue
      The user_id (from user table) might not have default value or it may not auto-increment,Either you can try by making it Auto-Increment or download the latest source code which I have just updated,Having sql file and remove initconfig path complications.
      If you will download the fresh source code , you need to change only dbconnect file, based on your sql database settings, remaining code does not need to modified,Try it it will work definitely.
      Kindly,first test it in local server.
      Thank You

Leave a Reply

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