<?php
require __DIR__ . '/../db_config.php';

$db = $conn->real_escape_string($DB_NAME ?? '');
echo "Looking for tables containing 'login' in database '$db'...\n";
$q = $conn->query("SELECT TABLE_NAME FROM information_schema.TABLES WHERE TABLE_SCHEMA = '{$db}' AND TABLE_NAME LIKE '%login%'");
if (!$q) {
    echo "Query failed: " . $conn->error . "\n";
    exit(1);
}
while ($r = $q->fetch_assoc()) {
    $t = $r['TABLE_NAME'];
    echo "\nTable: $t\n";
    $cols = $conn->query("SHOW COLUMNS FROM `{$t}`");
    if ($cols) {
        while ($c = $cols->fetch_assoc()) {
            echo sprintf("  %s %s %s\n", $c['Field'], $c['Type'], $c['Null']);
        }
    }
}
exit(0);
