www/comandosbck.php
2026-06-27 21:44:44 +00:00

56 lines
1.6 KiB
PHP

<?php
// ---------------- DB ----------------
$dbHost = "localhost";
$dbName = "cagalhao";
$dbUser = "master";
$dbPass = "master";
try {
$db = new PDO("mysql:host=$dbHost;dbname=$dbName;charset=utf8", $dbUser, $dbPass);
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (PDOException $e) {
die("Erro DB: " . $e->getMessage());
}
$stmt = $db->query("SELECT * FROM comandos ORDER BY id DESC LIMIT 50");
$comandos = $stmt->fetchAll(PDO::FETCH_ASSOC);
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Histórico de Comandos</title>
<style>
body { font-family: Arial, sans-serif; background: #111; color: #eee; }
table { border-collapse: collapse; width: 100%; margin-top: 10px; }
th, td { border: 1px solid #444; padding: 6px 10px; text-align: center; }
th { background: #222; }
tr:nth-child(even) { background: #1b1b1b; }
</style>
</head>
<body>
<h1>Histórico de Comandos</h1>
<table>
<tr>
<th>ID</th>
<th>UID</th>
<th>CMD</th>
<th>Params</th>
<th>Status</th>
<th>Data</th>
</tr>
<?php foreach ($comandos as $cmd): ?>
<tr>
<td><?= $cmd['id'] ?></td>
<td><?= htmlspecialchars($cmd['uid']) ?></td>
<td><?= htmlspecialchars($cmd['cmd']) ?></td>
<td><pre><?= htmlspecialchars($cmd['params']) ?></pre></td>
<td><?= $cmd['status'] ?></td>
<td><?= $cmd['created_at'] ?? '' ?></td>
</tr>
<?php endforeach; ?>
</table>
<p><a href="/api/menu.php">⬅️ Voltar</a></p>
</body>
</html>