HTML JAVASCRIPT MYSQL PHP

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

 config.php
 index.php
 check_availability.php
 login.php
 welcome.php
 logout.php

Structure of sql table tblregistration

config.php

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*****

index.php

Create a html form for user registration .

Jquery / Ajax for user email availability

check_availability.php

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):




Welcome.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.







2 Replies to “User registration and login using PHP

Leave a Reply

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