Today in this blog we will see How to Create a Login and Signup page in PHP and how to reset the password by login and how to enter the username in the index page without using SESSION.
How to Build a Login and signup System with PHP and MySQL. Here is a quick solution to build a login system with PHP and MySQL. Nowadays almost every website provides registration and login functionality. Thus, it is necessary to add a login system to modern web applications.
In this tutorial, we walk you through the entire process of creating a user registration system. Users can create an account by providing a username, password, Confirm Password. Once the account is created, the user can log in to his/her own account. Once the user login, it will redirect to the dashboard page. In addition, the user can log out from his panel. This complete system we are developing uses PHP and MySQL.
Plus, we’ll show you how to create secure pages that are only accessible by logged-in users. Without login, the user cannot access the page.
How to create login and signup page in PHP, follow it as given below.
Table of Contents
Step 1: Create a New Database
Create a new database named is “myweb“.
Create new Database MySQL Query
CREATE DATABASE myweb;
Step 2: Create a New Table
In the new database, create a new table named “users”.
Create a new table MySQL Query
CREATE TABLE `users` (
`id` int(11) NOT NULL,
`username` varchar(50) NOT NULL,
`password` varchar(255) NOT NULL,
`created_at` datetime DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
Step3: Create a config.php File.
In the config.php file, you add your database name and database credentials. Assuming you are running MySQL Server with default settings (user with no password ‘root’) must be entered.
Step4: Session Create for Logged in User
Create a new File named session.php File. Create a new File named session.php File. Include this file index.php and other files.
Step5: Create a Signup Form.
Example:- For sign-up, we will create a new file named registration.php.
Sign Up
Sign Up
Please fill this form to create an account.
Output:-
The output of the above code will look like this.

Step6: Create a Login Form.
Example:- For Login, we will create a new file named Login.php.
Login
Login
Please fill in your credentials to login.
' . $login_err . '';
}
?>