| File | Purpose | Key Concept |
|---|---|---|
config/server.php |
The "Bridge" | Connects your PHP code to the MySQL Database (XAMPP). |
auth/register.php |
The "Front-Door" | The HTML form where users type their information. |
backend/register_db.php |
The "Officer" | Processes registration logic. |
auth/login.php |
The "ID Check" | HTML form for returning users. |
backend/login_db.php |
The "Security" | Verifies login credentials. |
home/index.php |
The "Private Room" | The homepage for logged-in users. |
backend/error.php |
The "Feedback" | Shows error messages. |
css/style.css |
The "Makeup" | Styling for the application. |
$_POST: Used to grab data from forms (e.g.,$_POST['username']).$_SESSION: Used to "remember" a user across different pages. Crucial: Always putsession_start();at the very top of files that use sessions.
Found in server.php. If your system isn't working, check these 4 things:
- Host: Usually
localhost - User: Usually
root - Password: Empty
""by default in XAMPP - DB Name: Must match exactly what you named it in phpMyAdmin (
register_db)
Never store passwords as plain text! In this project, you use md5($password). While there are stronger methods (like password_hash), MD5 is a great starting point for learning.
Before inserting a new user, you must run a SELECT query to see if the username or email already exists. If the database returns a result, you stop the registration and show an error.