[ 'name' => 'PHP Version (>= 8.0)', 'status' => version_compare(PHP_VERSION, '8.0.0', '>='), 'current' => PHP_VERSION ], 'pdo_mysql' => [ 'name' => 'PDO MySQL Extension', 'status' => extension_loaded('pdo_mysql'), 'current' => extension_loaded('pdo_mysql') ? 'Loaded' : 'Missing' ], 'config_writable' => [ 'name' => 'db/config.php Writable', 'status' => is_writable(__DIR__ . '/../db/config.php'), 'current' => is_writable(__DIR__ . '/../db/config.php') ? 'Yes' : 'No' ], 'root_writable' => [ 'name' => 'Root Directory Writable', 'status' => is_writable(__DIR__ . '/..'), 'current' => is_writable(__DIR__ . '/..') ? 'Yes' : 'No' ] ]; $allOk = true; foreach ($requirements as $req) { if (!$req['status']) $allOk = false; } } // Step 2: Database if ($step === 2 && $_SERVER['REQUEST_METHOD'] === 'POST') { $host = $_POST['db_host'] ?? ''; $name = $_POST['db_name'] ?? ''; $user = $_POST['db_user'] ?? ''; $pass = $_POST['db_pass'] ?? ''; try { $pdo = new PDO("mysql:host=$host;dbname=$name", $user, $pass, [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION]); // Save to config.php $configContent = " PDO::ERRMODE_EXCEPTION,\n PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,\n ]);\n }\n return \$pdo;\n}\n"; file_put_contents(__DIR__ . '/../db/config.php', $configContent); header("Location: index.php?step=3"); exit; } catch (PDOException $e) { $error = "Database Connection Failed: " . $e->getMessage(); } } // Step 3: Super Admin if ($step === 3 && $_SERVER['REQUEST_METHOD'] === 'POST') { require_once __DIR__ . '/../db/config.php'; $adminUser = $_POST['admin_user'] ?? ''; $adminPass = $_POST['admin_pass'] ?? ''; $adminEmail = $_POST['admin_email'] ?? ''; try { $pdo = db(); // Create tables if they don't exist $pdo->exec("CREATE TABLE IF NOT EXISTS role_groups ( id INT AUTO_INCREMENT PRIMARY KEY, name VARCHAR(50) NOT NULL, permissions TEXT )"); $pdo->exec("CREATE TABLE IF NOT EXISTS users ( id INT AUTO_INCREMENT PRIMARY KEY, username VARCHAR(50) NOT NULL UNIQUE, password VARCHAR(255) NOT NULL, email VARCHAR(100), phone VARCHAR(20), group_id INT, status ENUM('active', 'inactive') DEFAULT 'active', profile_pic VARCHAR(255), created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP )"); // Insert Default Admin Role if missing $stmt = $pdo->prepare("SELECT id FROM role_groups WHERE name = 'Administrator'"); $stmt->execute(); $role = $stmt->fetch(); if (!$role) { $pdo->exec("INSERT INTO role_groups (name, permissions) VALUES ('Administrator', 'all')"); $roleId = $pdo->lastInsertId(); } else { $roleId = $role['id']; } // Insert Admin User $hashedPass = password_hash($adminPass, PASSWORD_DEFAULT); $stmt = $pdo->prepare("INSERT INTO users (username, password, email, group_id, status) VALUES (?, ?, ?, ?, 'active')"); $stmt->execute([$adminUser, $hashedPass, $adminEmail, $roleId]); header("Location: index.php?step=4"); exit; } catch (Exception $e) { $error = "Setup Failed: " . $e->getMessage(); } } // Step 4: Finish if ($step === 4) { file_put_contents($lockFile, date('Y-m-d H:i:s')); } ?> Installation - Step <?= $step ?>

System Installation

Configure your application in minutes

1 ? '' : '1' ?>
2 ? '' : '2' ?>
3 ? '' : '3' ?>
4
Step 1: Check Requirements
Current:
Passed Failed
Please fix the issues above to continue.
Step 2: Database Configuration
Step 3: Super Admin Setup

Ready to Launch!

Installation completed successfully. Your system is now secure and ready to use.

For security, the installed.lock file has been created.