Accounts module (standalone)

This folder provides a simple standalone account system for your site:
- User registration
- Login
- Logout
- Basic dashboard
- Database-backed sessions using a user_sessions table

FILES
=====
config.php      - Database connection settings (edit this first)
db.php          - PDO connection helper
auth.php        - Session helpers (login, logout, require_login, get_current_user)
header.php      - Shared page header + basic styling
footer.php      - Shared page footer
register.php    - Registration page
login.php       - Login page
logout.php      - Logout handler
dashboard.php   - Example protected page
README.txt      - This file

USAGE
=====
1. Upload the entire "accounts" folder to your server, for example:
   https://yourdomain.com/accounts/

2. In phpMyAdmin, run the provided SQL file to create the "users" and
   "user_sessions" tables (you can use the same database as the analyzer).

3. Edit config.php and set:
   - DB_HOST
   - DB_NAME
   - DB_USER
   - DB_PASS

4. Visit:
   - /accounts/register.php  to create a new user
   - /accounts/login.php     to sign in
   - /accounts/dashboard.php as a test protected page

PROTECTING OTHER PAGES
======================
To protect any page in another folder (e.g., your analyzer):
- Add at the very top of the PHP file:

    <?php
    require_once __DIR__ . '/../accounts/auth.php';
    $user = require_login();
    ?>

- Now $user contains the logged-in user's data (from the "users" table).

SESSION LIFETIME
================
SESSION_LIFETIME is defined in config.php (default: 7 days).
You can reduce it (e.g., 60 * 60 * 2 for 2 hours).

