User registration and login using PHP

elcome friends in this tutorial we will learn user registration and login using php stored procedure.
File structure for this tutorial


Structure of sql table tblregistration


Create db configuration file using mysqli extension. Provide credential as per your configuration

*****Note if you declared a password variable for your localhost server then you have to create a new privilege for this code to work*****


Create a html form for user registration .

Jquery / Ajax for user email availability


In this page we will check the user email availability. Create a store procedure with name check availability

Store procedure code :

Now create a store procedure for user registration.

Store procedure for user registration

After creation of store procedure execute the store procedure.

Here is the full code that we have written for registration (index.php):

login .php

Create a login form user login.

Now create a store procedure for login with name login.
Login store procedure :

Now execute the login store procedure

Here is the full code that we have written for login(login.php):


After login user will redirect to welcome.php page. We will validate this page with the session if any user  try to access this page(welcome.php) directly  then user will redirect to login.php page.

Related Post

2 Comments on “User registration and login using PHP”

Leave a Reply

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