Simple login and registration form using SQL and PHP
By Akilasri B
A simple login and registration form using SQL, PHP, CSS and HTML. Users can register and login using this form. All of the data is kept in a SQL database.
It's a web-based application that allows you to sign up and log in. This project's design is basic enough that the developer may quickly add a registration and login page to their project, and users will have no trouble utilising it.
- Database - MySQL
- Backend – PHP
- Frontend – HTML and CSS
- registration.php gives the user an html form to fill up and then validates it with regular expressions when they submit it. It then connects to the MySQL server and checks for duplicate usernames or emails before creating a new user entry in the database, starting a new session by initialising session variables, and displaying the register success message.
- login.php sends a form to the client, which when submitted, retrieves data from the database by username, compares passwords, and, if they match, creates a new session and sends the client to index.php.
- index.php The user is greeted with index.php, which continues the session started by registration.php or login.php. When a user clicks logout, the current session is ended and the user is sent to login.php. This page redirects to login.php if session variables aren't set, the username in session variables isn't in the database, or the password doesn't match. As a result, this page can't be visited without checking in with proper credentials.
If you wish to execute this project locally, you'll need to set up a server (like XAMPP, WAMPP, or something similar). I used the XAMPP server to demonstrate this. Download the project zip file to your computer's htdocs folder and unzip it.
Create a database called "authentication" at http://localhost/phpmyadmin, then click the Import tab, select " authenticationDB.sql" from the SQL folder, and push the Go button. It creates a database with several tables. In the db.php file in your authentication, change the server username and password. After that, save your file.
After the database has been successfully created, open a new tab in your browser and go to http://localhost/ authentication. This will take you to our login page and you can access the above feature.