query("SELECT COUNT(*) FROM users")->fetchColumn();
// If at least one user exists, show a message and no form
if ($checkTotal > 0) {
?>
Setup Admin User
Admin User Already Exists
An admin user has already been created. No additional admins can be set up here.
Go back to the Polls site.
prepare("
INSERT INTO users (username, password)
VALUES (:username, :password)
");
$insertStmt->bindValue(':username', $username, PDO::PARAM_STR);
$insertStmt->bindValue(':password', $hashedPassword, PDO::PARAM_STR);
$insertStmt->execute();
$success = "Admin user '$username' created successfully.";
}
}
?>
Setup Admin User