-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck_admin_users.php
More file actions
35 lines (29 loc) · 1.18 KB
/
check_admin_users.php
File metadata and controls
35 lines (29 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
try {
$dsn = "pgsql:host=localhost;port=5432;dbname=fivem_dashboard";
$pdo = new PDO($dsn, 'postgres', '');
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
// Check staff accounts
$stmt = $pdo->query("SELECT id, username, name, rank, is_active FROM staff_accounts ORDER BY created_at");
$users = $stmt->fetchAll(PDO::FETCH_ASSOC);
echo "Current staff accounts:\n";
foreach ($users as $user) {
echo "- {$user['username']} ({$user['name']}) - {$user['rank']} - " . ($user['is_active'] ? 'Active' : 'Inactive') . "\n";
}
// If no active users, create a test user
if (empty($users)) {
echo "\nCreating test user...\n";
$password = password_hash('admin123', PASSWORD_DEFAULT);
$stmt = $pdo->prepare("
INSERT INTO staff_accounts (username, password, name, rank, is_active)
VALUES (?, ?, ?, ?, ?)
");
$stmt->execute(['admin', $password, 'Admin User', 'Administrator', true]);
echo "✅ Test user created:\n";
echo "Username: admin\n";
echo "Password: admin123\n";
}
} catch (Exception $e) {
echo "Error: " . $e->getMessage() . "\n";
}
?>