setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); // Create database if it doesn't exist $pdo->exec("CREATE DATABASE IF NOT EXISTS `$db_name` CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci"); $pdo->exec("USE `$db_name`"); // Import SQL schema $sql = file_get_contents('database.sql'); $pdo->exec($sql); // Update admin user with provided credentials if ($ldap_enabled) { // For LDAP, don't require local password $stmt = $pdo->prepare("UPDATE users SET username = ?, email = ?, auth_type = 'ldap' WHERE username = 'admin'"); $stmt->execute([$admin_username, $admin_email]); } else { $hashed_password = password_hash($admin_password, PASSWORD_DEFAULT); $stmt = $pdo->prepare("UPDATE users SET username = ?, password = ?, email = ?, auth_type = 'local' WHERE username = 'admin'"); $stmt->execute([$admin_username, $hashed_password, $admin_email]); } // Create configuration file $config_content = "getMessage(); } } } ?>
The system has been successfully installed. You can now:
Important: Delete the setup directory for security.