34000-vm/update_user_role.php
2025-09-10 21:21:48 +00:00

17 lines
581 B
PHP

<?php
require_once __DIR__ . '/db/config.php';
try {
$pdo = db();
$stmt = $pdo->prepare("UPDATE users SET role = 'super_admin' WHERE username = 'admin'");
$stmt->execute();
if ($stmt->rowCount() > 0) {
echo "User role updated successfully. You can now log in to the admin panel. Please delete this file immediately.";
} else {
echo "Could not find the 'admin' user or the role is already 'super_admin'. Please check your database. You can delete this file.";
}
} catch (PDOException $e) {
echo "Database error: " . $e->getMessage();
}