<?php
/**
 * Home / Landing Page
 * PHP User Registration - https://rskworld.in
 * Developer: Molla Samser | RSK World
 * Contact: help@rskworld.in | +91 93305 39277
 * Year: 2026
 */

require_once __DIR__ . '/includes/init.php';
require_once __DIR__ . '/includes/functions.php';

ensureDemoUser();

if (isLoggedIn()) {
    header('Location: dashboard.php');
    exit;
}

require_once __DIR__ . '/config/demo.php';
$demoIds = getDemoUserIds();
$pageTitle = 'Home';
require_once __DIR__ . '/includes/header.php';
?>

<div class="landing">
    <h1><i class="fas fa-user-plus text-primary"></i> PHP User Registration</h1>
    <p class="tagline">Complete user registration with PHP, MySQL, sessions &amp; email verification.</p>
    <p class="credit">By <a href="https://rskworld.in" target="_blank">RSK World</a> — Molla Samser | 2026</p>
    <div class="demo-boxes">
        <div class="demo-box">
            <strong><i class="fas fa-user"></i> Demo User</strong>
            <p>ID: <code><?= $demoIds['demo'] ?? '—' ?></code> &nbsp;|&nbsp; Email: <code><?= htmlspecialchars(DEMO_EMAIL) ?></code> &nbsp;|&nbsp; Password: <code><?= htmlspecialchars(DEMO_PASSWORD) ?></code></p>
            <a href="login.php" class="btn btn-demo">Try demo user</a>
        </div>
        <div class="demo-box demo-admin-box">
            <strong><i class="fas fa-user-shield"></i> Demo Admin</strong>
            <p>ID: <code><?= $demoIds['admin'] ?? '—' ?></code> &nbsp;|&nbsp; Email: <code><?= htmlspecialchars(DEMO_ADMIN_EMAIL) ?></code> &nbsp;|&nbsp; Password: <code><?= htmlspecialchars(DEMO_ADMIN_PASSWORD) ?></code></p>
            <a href="login.php" class="btn btn-demo">Try demo admin</a>
        </div>
        <div class="demo-box demo-superadmin-box">
            <strong><i class="fas fa-crown"></i> Demo Super Admin</strong>
            <p>ID: <code><?= $demoIds['superadmin'] ?? '—' ?></code> &nbsp;|&nbsp; Email: <code><?= htmlspecialchars(DEMO_SUPERADMIN_EMAIL) ?></code> &nbsp;|&nbsp; Password: <code><?= htmlspecialchars(DEMO_SUPERADMIN_PASSWORD) ?></code></p>
            <a href="login.php" class="btn btn-demo">Try demo super admin</a>
        </div>
    </div>
    <div class="landing-actions">
        <a href="register.php" class="btn btn-primary">Register</a>
        <a href="login.php" class="btn btn-secondary">Log In</a>
    </div>
    <ul class="feature-list">
        <li><i class="fas fa-check"></i> User registration</li>
        <li><i class="fas fa-check"></i> Email verification</li>
        <li><i class="fas fa-check"></i> Password hashing</li>
        <li><i class="fas fa-check"></i> Session management</li>
        <li><i class="fas fa-check"></i> Login &amp; dashboard</li>
    </ul>
</div>

<?php require_once __DIR__ . '/includes/footer.php'; ?>
