'' * Gibt KEINE Geheimnisse aus - nur Statusfelder und ein verify-Ergebnis. */ if ($argc < 2) { fwrite(STDERR, "Aufruf: php migrations/check_feuser.php ['']\n"); exit(1); } $username = $argv[1]; $password = $argv[2] ?? null; $settings = require __DIR__ . '/../config/system/settings.php'; $db = $settings['DB']['Connections']['Default']; $pdo = new PDO( 'mysql:host=' . $db['host'] . ';dbname=' . $db['dbname'] . ';charset=utf8mb4', $db['user'], $db['password'] ); $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $stmt = $pdo->prepare( 'SELECT uid, pid, username, usergroup, disable, deleted, starttime, endtime, password FROM fe_users WHERE username = ?' ); $stmt->execute([$username]); $rows = $stmt->fetchAll(PDO::FETCH_ASSOC); if (!$rows) { echo "KEIN fe_users-Datensatz mit username='$username' gefunden (auch kein geloeschter).\n"; exit(0); } $now = time(); foreach ($rows as $r) { echo "--- fe_users uid={$r['uid']} ---\n"; echo 'pid: ' . $r['pid'] . ($r['pid'] == 520 ? ' (ok)' : ' <-- NICHT 520! Login-POST braucht pid=' . $r['pid']) . "\n"; echo 'usergroup: "' . $r['usergroup'] . '"' . (in_array('1', array_map('trim', explode(',', (string)$r['usergroup'])), true) ? ' (enthaelt Gruppe 1, ok)' : ' <-- Gruppe 1 FEHLT') . "\n"; echo 'deleted: ' . $r['deleted'] . ($r['deleted'] ? ' <-- GELOESCHT' : ' (ok)') . "\n"; echo 'disable: ' . $r['disable'] . ($r['disable'] ? ' <-- DEAKTIVIERT' : ' (ok)') . "\n"; echo 'starttime: ' . $r['starttime'] . ($r['starttime'] > $now ? ' <-- liegt in der ZUKUNFT' : ' (ok)') . "\n"; echo 'endtime: ' . $r['endtime'] . (($r['endtime'] && $r['endtime'] < $now) ? ' <-- ABGELAUFEN' : ' (ok)') . "\n"; $hash = (string)$r['password']; $prefix = substr($hash, 0, strpos($hash, '$', 1) ?: 8); echo 'hash-typ: ' . ($prefix !== '' ? $prefix : '(leer!)') . "\n"; if ($password !== null) { if (str_starts_with($hash, '$argon2') || str_starts_with($hash, '$2y$')) { echo 'passwort: ' . (password_verify($password, $hash) ? 'VERIFIZIERT - stimmt mit dem Hash ueberein' : 'FALSCH - stimmt NICHT mit dem Hash ueberein') . "\n"; } else { echo "passwort: Hash-Format unbekannt, kein lokaler Verify moeglich\n"; } } } // Gruppe 1 existiert und ist nicht versteckt/geloescht? $g = $pdo->query('SELECT uid, pid, title, hidden, deleted FROM fe_groups WHERE uid = 1')->fetch(PDO::FETCH_ASSOC); echo "--- fe_groups uid=1 ---\n"; echo $g ? "title: \"{$g['title']}\" pid: {$g['pid']} hidden: {$g['hidden']} deleted: {$g['deleted']}\n" : "EXISTIERT NICHT!\n";