This project is a basic web authentication system built with PHP. It includes user registration, login, and logout functionalities, as well as a protected dashboard for authenticated users.
- User Registration
- User Login
- User Logout
- Protected Dashboard
- Error Handling
/Basic Web Auth
├── auth
│   ├── login.php
│   ├── logout.php
│   ├── register.php
├── template
│   ├── admin
│   │   └── dashboard.php
│   ├── auth
│   │   ├── login.php
│   │   └── register.php
│   ├── home.php
├── .htaccess
├── config.php
├── index.php
├── dashboard.php
└── README.md
- Clone the repository to your local machine.
- Create a MySQL database and execute the provided SQL query to create the necessary tables:
CREATE TABLE users (
    id INT PRIMARY KEY AUTO_INCREMENT,
    username VARCHAR(50) NOT NULL UNIQUE,
    email VARCHAR(100) NOT NULL UNIQUE,
    password VARCHAR(255) NOT NULL,
    created_at DATETIME DEFAULT CURRENT_TIMESTAMP
);- Update the config.phpfile with your database credentials.
- Navigate to the home page: /index.php
- You will find links to login and register.
- Navigate to the registration page: /auth/register.php
- Fill in the required fields and submit the form.
- Proper error messages will be displayed if the username is already taken or if the passwords do not match.
- Navigate to the login page: /auth/login.php
- Enter your username and password, then submit the form.
- Proper error messages will be displayed if the username or password is incorrect.
- After logging in, you will be redirected to the dashboard: /dashboard.php
- The dashboard is protected and only accessible to authenticated users.
- Click the logout link on the dashboard to end your session.
This project is licensed under the MIT License.