![]() Server : Apache/2 System : Linux server-15-235-50-60 5.15.0-164-generic #174-Ubuntu SMP Fri Nov 14 20:25:16 UTC 2025 x86_64 User : gositeme ( 1004) PHP Version : 8.2.29 Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname Directory : /home/gositeme/domains/soundstudiopro.com/private_html/ |
<?php
session_start();
require_once 'config/database.php';
// Check if user is admin
if (!isset($_SESSION['user_id']) || !isset($_SESSION['is_admin']) || !$_SESSION['is_admin']) {
die('Access denied. Admin access required.');
}
$pdo = getDBConnection();
if (!$pdo) {
die('Database connection failed.');
}
// Get all users
try {
$stmt = $pdo->query("
SELECT
id,
name,
email,
password,
credits,
plan,
is_admin,
created_at
FROM users
ORDER BY id ASC
");
$users = $stmt->fetchAll();
} catch (Exception $e) {
die('Error fetching users: ' . $e->getMessage());
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>User List - SoundStudioPro</title>
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
background: #0f172a;
color: #e2e8f0;
padding: 2rem;
margin: 0;
}
.container {
max-width: 1400px;
margin: 0 auto;
}
h1 {
color: #fff;
margin-bottom: 0.5rem;
}
.warning {
background: #f59e0b;
color: #1e293b;
padding: 1rem;
border-radius: 8px;
margin-bottom: 2rem;
font-weight: 600;
}
table {
width: 100%;
border-collapse: collapse;
background: rgba(255, 255, 255, 0.05);
border-radius: 8px;
overflow: hidden;
}
th {
background: rgba(255, 255, 255, 0.1);
padding: 1rem;
text-align: left;
font-weight: 600;
color: #fff;
}
td {
padding: 1rem;
border-top: 1px solid rgba(255, 255, 255, 0.1);
}
tr:hover {
background: rgba(255, 255, 255, 0.05);
}
.email {
color: #60a5fa;
}
.password-hash {
font-family: monospace;
font-size: 0.85rem;
color: #94a3b8;
word-break: break-all;
max-width: 300px;
}
.admin-badge {
background: #f59e0b;
color: #1e293b;
padding: 0.25rem 0.5rem;
border-radius: 4px;
font-size: 0.85rem;
font-weight: 600;
}
.plan-badge {
padding: 0.25rem 0.5rem;
border-radius: 4px;
font-size: 0.85rem;
font-weight: 600;
}
.plan-free { background: #475569; color: #fff; }
.plan-starter { background: #3b82f6; color: #fff; }
.plan-pro { background: #8b5cf6; color: #fff; }
.export-btn {
background: #3b82f6;
color: white;
padding: 0.75rem 1.5rem;
border: none;
border-radius: 8px;
cursor: pointer;
font-weight: 600;
margin-bottom: 1rem;
text-decoration: none;
display: inline-block;
}
.export-btn:hover {
background: #2563eb;
}
</style>
</head>
<body>
<div class="container">
<h1>User Accounts List</h1>
<div class="warning">
⚠️ <strong>Important:</strong> Passwords are hashed using PHP's password_hash() function and cannot be retrieved in plain text.
This is a security feature. To access a user's account, use the "Login as User" feature in the admin panel.
</div>
<a href="?export=csv" class="export-btn">Export to CSV</a>
<table>
<thead>
<tr>
<th>ID</th>
<th>Name</th>
<th>Email</th>
<th>Password Hash</th>
<th>Plan</th>
<th>Credits</th>
<th>Admin</th>
<th>Created</th>
</tr>
</thead>
<tbody>
<?php foreach ($users as $user): ?>
<tr>
<td><?= htmlspecialchars($user['id']) ?></td>
<td><?= htmlspecialchars($user['name']) ?></td>
<td class="email"><?= htmlspecialchars($user['email']) ?></td>
<td>
<div class="password-hash" title="Hashed password (cannot be decrypted)">
<?= htmlspecialchars(substr($user['password'], 0, 50)) ?>...
</div>
</td>
<td>
<span class="plan-badge plan-<?= strtolower($user['plan']) ?>">
<?= ucfirst($user['plan']) ?>
</span>
</td>
<td><?= $user['credits'] ?></td>
<td>
<?php if ($user['is_admin']): ?>
<span class="admin-badge">Admin</span>
<?php else: ?>
-
<?php endif; ?>
</td>
<td><?= date('Y-m-d H:i', strtotime($user['created_at'])) ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<p style="margin-top: 2rem; color: #94a3b8;">
Total users: <strong><?= count($users) ?></strong>
</p>
</div>
<?php
// Handle CSV export
if (isset($_GET['export']) && $_GET['export'] === 'csv') {
header('Content-Type: text/csv');
header('Content-Disposition: attachment; filename="users_export_' . date('Y-m-d') . '.csv"');
$output = fopen('php://output', 'w');
// CSV headers
fputcsv($output, ['ID', 'Name', 'Email', 'Password Hash', 'Plan', 'Credits', 'Is Admin', 'Created At']);
// CSV data
foreach ($users as $user) {
fputcsv($output, [
$user['id'],
$user['name'],
$user['email'],
$user['password'],
$user['plan'],
$user['credits'],
$user['is_admin'] ? 'Yes' : 'No',
$user['created_at']
]);
}
fclose($output);
exit;
}
?>
</body>
</html>