Index.php/login pagethis file also contains html form with two input box which will take user email and user password entered by user and then after submitting the form, the php code will match that user email and password combination in database and when it finds both results in table then it will start a session and allow user to access home page else it will show appropriate message.Īfter registration page and login page we need to create ‘home‘ page which shows users dashboard, which is authentic page and this page cannot access without logging in. I’ve written this login script with little bit security to prevent your website from sql injection. Now, after creating registration page, then move ahead to create login page. all the user registration process can be done in this single php file.Ĭoding Cage - Login & Registration System Save this file as ‘ register.php‘, this file contains simple html form with all the required registration fields except user id because it’s auto incremented and some php code for registering a new user. Register.phpcontains simple html form and few lines of php code. If you want to know more about validations click here : validations > I have used here simple HTML5 required attribute to validate the following register and login forms.
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 copy-paste the above sql code into phpmyqdmin to create database and table.ĭbconnect.phpcontains code for localhost connection and database selection. `userId` int(11) NOT NULL AUTO_INCREMENT, You can create it by importing following sql command in to your phpmyadmin. Read also : Login and Registration with PHP MySQLiįirst of all create a database and table as below. Read also : Login Script with Email Verification & Forgot Password using PHP Read also : Login and Registration with PDO and OOP