Step 1: db_user
(Creating the users
table)
You have a SQL statement that creates a table for storing user data. The table includes columns for id
, email
, password
, and created_at
. This will be the structure for user authentication.
Step 2: config.php
(Database connection)
This PHP script defines the database connection details and connects to the MySQL server.
Step 3: php_register.php
(Registration logic)
This script handles user registration, including validating inputs, checking for existing email addresses, and inserting user data into the database. It also hashes the password using password_hash
.
Step 4: sign-up.html
(Registration Form)
This HTML form allows users to input their email and password and confirm their password to register.
Step 5: login.php
(Login Form)
This form allows users to enter their email and password to log in. If the credentials are correct, the user will be redirected to the welcome.php
page.
Step 6: php_login.php
(Login logic)
This PHP script validates user credentials. If the email and password match, it starts a session and redirects to welcome.php
.
Step 7: welcome.php
(Dashboard)
After a successful login, users are redirected to this page, where their email is displayed.
Step 8: logout.php
(Logout)
This file handles the logout process by destroying the session and redirecting the user to the login page.
This is a complete setup for a login system with registration, login, and a basic user dashboard. You can expand this system by adding additional features like password recovery, session management, and more. Let me know if you'd like to make any adjustments or need further assistance!