prepare("SELECT id FROM admins WHERE email = ?");
$stmt->execute([$email]);
if ($stmt->rowCount() > 0) {
die("Admin user with this email already exists!");
}
// Insert the new admin user
$sql = "INSERT INTO admins (full_name, email, password_hash) VALUES (?, ?, ?)";
$stmt = $pdo->prepare($sql);
$stmt->execute([$fullName, $email, $password_hash]);
echo "Admin user created successfully!
";
echo "Email: " . htmlspecialchars($email) . "
";
echo "Password: " . htmlspecialchars($password) . "
";
echo "IMPORTANT: Please delete this file (create_admin.php) immediately for security.";
} catch (PDOException $e) {
die("ERROR: Could not execute $sql. " . $e->getMessage());
}
// Close connection
unset($pdo);
?>