Initial commit (code), runtime ignoré, secrets exclus
This commit is contained in:
62
show_table_utilisateurs.php
Normal file
62
show_table_utilisateurs.php
Normal file
@ -0,0 +1,62 @@
|
||||
<?php
|
||||
require_once '/var/www/mathematiques/config/database.php';
|
||||
$db = Database::getInstance()->getConnection();
|
||||
|
||||
echo "<!DOCTYPE html><html><head><meta charset='UTF-8'>";
|
||||
echo "<style>
|
||||
body { font-family: monospace; padding: 20px; background: #f5f5f5; }
|
||||
h1, h2 { color: #333; }
|
||||
table { border-collapse: collapse; width: 100%; margin: 20px 0; background: white; }
|
||||
th, td { border: 1px solid #ddd; padding: 12px; text-align: left; }
|
||||
th { background: #667eea; color: white; }
|
||||
.required { color: red; font-weight: bold; }
|
||||
.nullable { color: green; }
|
||||
</style></head><body>";
|
||||
|
||||
echo "<h1>🔍 Structure de la table 'utilisateurs'</h1>";
|
||||
|
||||
echo "<h2>📊 Colonnes de la table</h2>";
|
||||
echo "<table>";
|
||||
echo "<tr><th>Colonne</th><th>Type</th><th>NULL autorisé</th><th>Valeur par défaut</th><th>Extra</th></tr>";
|
||||
|
||||
$stmt = $db->query("DESCRIBE utilisateurs");
|
||||
$columns = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
foreach ($columns as $col) {
|
||||
$null_status = $col['Null'] == 'NO' ? "<span class='required'>NON (obligatoire)</span>" : "<span class='nullable'>OUI</span>";
|
||||
$default = $col['Default'] ?? '<em>NULL</em>';
|
||||
|
||||
echo "<tr>";
|
||||
echo "<td><strong>{$col['Field']}</strong></td>";
|
||||
echo "<td>{$col['Type']}</td>";
|
||||
echo "<td>$null_status</td>";
|
||||
echo "<td>$default</td>";
|
||||
echo "<td>{$col['Extra']}</td>";
|
||||
echo "</tr>";
|
||||
}
|
||||
echo "</table>";
|
||||
|
||||
echo "<h2>📋 Utilisateurs existants (5 premiers)</h2>";
|
||||
$stmt = $db->query("SELECT * FROM utilisateurs LIMIT 5");
|
||||
$users = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
if (!empty($users)) {
|
||||
echo "<table>";
|
||||
echo "<tr>";
|
||||
foreach (array_keys($users[0]) as $key) {
|
||||
echo "<th>$key</th>";
|
||||
}
|
||||
echo "</tr>";
|
||||
|
||||
foreach ($users as $row) {
|
||||
echo "<tr>";
|
||||
foreach ($row as $value) {
|
||||
echo "<td>" . htmlspecialchars($value ?? 'NULL') . "</td>";
|
||||
}
|
||||
echo "</tr>";
|
||||
}
|
||||
echo "</table>";
|
||||
}
|
||||
|
||||
echo "</body></html>";
|
||||
?>
|
||||
Reference in New Issue
Block a user