neonail-database/debug-logout-detailed.php
2025-08-10 18:09:07 +02:00

203 lines
6.8 KiB
PHP
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
// Debug: Logout-Problem detailliert debuggen
echo "🔍 Debug: Logout-Problem detailliert debuggen\n";
echo "============================================\n\n";
// 1. Aktuelles Layout prüfen
echo "1. 🎨 Aktuelles Layout prüfen...\n";
$layoutPath = 'resources/views/layouts/app.blade.php';
if (file_exists($layoutPath)) {
$content = file_get_contents($layoutPath);
// Zeige alle Logout-bezogenen Zeilen
$lines = explode("\n", $content);
$logoutLines = [];
foreach ($lines as $lineNumber => $line) {
if (strpos($line, 'logout') !== false) {
$logoutLines[] = ($lineNumber + 1) . ": " . trim($line);
}
}
if (!empty($logoutLines)) {
echo " ✅ Logout-bezogene Zeilen gefunden:\n";
foreach ($logoutLines as $line) {
echo " 📋 $line\n";
}
} else {
echo " ❌ Keine Logout-bezogenen Zeilen gefunden\n";
}
} else {
echo " ❌ Layout-Datei nicht gefunden\n";
}
// 2. Routes prüfen
echo "\n2. 🛣️ Routes prüfen...\n";
$routesPath = 'routes/web.php';
if (file_exists($routesPath)) {
$content = file_get_contents($routesPath);
// Zeige alle Logout-bezogenen Zeilen
$lines = explode("\n", $content);
$logoutLines = [];
foreach ($lines as $lineNumber => $line) {
if (strpos($line, 'logout') !== false) {
$logoutLines[] = ($lineNumber + 1) . ": " . trim($line);
}
}
if (!empty($logoutLines)) {
echo " ✅ Logout-Routes gefunden:\n";
foreach ($logoutLines as $line) {
echo " 📋 $line\n";
}
} else {
echo " ❌ Keine Logout-Routes gefunden\n";
}
} else {
echo " ❌ Routes-Datei nicht gefunden\n";
}
// 3. LoginController prüfen
echo "\n3. 🔐 LoginController prüfen...\n";
$controllerPath = 'app/Http/Controllers/Auth/LoginController.php';
if (file_exists($controllerPath)) {
$content = file_get_contents($controllerPath);
if (strpos($content, 'public function logout') !== false) {
echo " ✅ Logout-Methode vorhanden\n";
// Zeige Logout-Methode
$lines = explode("\n", $content);
$inLogoutMethod = false;
$methodLines = [];
foreach ($lines as $lineNumber => $line) {
if (strpos($line, 'public function logout') !== false) {
$inLogoutMethod = true;
$methodLines[] = ($lineNumber + 1) . ": " . trim($line);
} elseif ($inLogoutMethod && strpos($line, 'public function') !== false) {
$inLogoutMethod = false;
} elseif ($inLogoutMethod) {
$methodLines[] = ($lineNumber + 1) . ": " . trim($line);
}
}
echo " 📋 Logout-Methode:\n";
foreach ($methodLines as $line) {
echo " $line\n";
}
} else {
echo " ❌ Logout-Methode nicht gefunden\n";
}
} else {
echo " ❌ LoginController nicht gefunden\n";
}
// 4. Einfache Logout-Route erstellen
echo "\n4. 🛣️ Einfache Logout-Route erstellen...\n";
$routesPath = 'routes/web.php';
if (file_exists($routesPath)) {
$content = file_get_contents($routesPath);
// Prüfe ob GET Logout-Route existiert
if (strpos($content, "Route::get('/logout', [LoginController::class, 'logout'])->name('logout');") === false) {
// Füge GET Logout-Route hinzu
$newRoute = "\n// Einfache Logout-Route für Debugging\nRoute::get('/logout', [App\\Http\\Controllers\\Auth\\LoginController::class, 'logout'])->name('logout');\n";
// Füge am Ende der Datei hinzu
$content .= $newRoute;
file_put_contents($routesPath, $content);
echo " ✅ GET Logout-Route hinzugefügt\n";
} else {
echo " GET Logout-Route bereits vorhanden\n";
}
} else {
echo " ❌ Routes-Datei nicht gefunden\n";
}
// 5. LoginController erweitern
echo "\n5. 🔐 LoginController erweitern...\n";
$controllerPath = 'app/Http/Controllers/Auth/LoginController.php';
if (file_exists($controllerPath)) {
$content = file_get_contents($controllerPath);
// Prüfe ob Logout-Methode GET und POST unterstützt
if (strpos($content, 'public function logout(Request $request)') !== false) {
echo " ✅ Logout-Methode unterstützt bereits GET und POST\n";
} else {
echo " Logout-Methode prüfen...\n";
}
// Zeige aktuelle Logout-Methode
$lines = explode("\n", $content);
$inLogoutMethod = false;
$methodLines = [];
foreach ($lines as $lineNumber => $line) {
if (strpos($line, 'public function logout') !== false) {
$inLogoutMethod = true;
$methodLines[] = ($lineNumber + 1) . ": " . trim($line);
} elseif ($inLogoutMethod && strpos($line, 'public function') !== false) {
$inLogoutMethod = false;
} elseif ($inLogoutMethod) {
$methodLines[] = ($lineNumber + 1) . ": " . trim($line);
}
}
echo " 📋 Aktuelle Logout-Methode:\n";
foreach ($methodLines as $line) {
echo " $line\n";
}
} else {
echo " ❌ LoginController nicht gefunden\n";
}
// 6. Cache leeren
echo "\n6. 🧹 Cache leeren...\n";
system('php artisan cache:clear 2>/dev/null || echo " ⚠️ cache:clear übersprungen"');
system('php artisan config:clear 2>/dev/null || echo " ⚠️ config:clear übersprungen"');
system('php artisan view:clear 2>/dev/null || echo " ⚠️ view:clear übersprungen"');
system('php artisan route:clear 2>/dev/null || echo " ⚠️ route:clear übersprungen"');
echo " ✅ Cache geleert\n";
// 7. Test-Logout-Links erstellen
echo "\n7. 🧪 Test-Logout-Links erstellen...\n";
$testLinks = [
'https://neonail.vogt.de.com/logout (GET)',
'https://neonail.vogt.de.com/logout (POST)',
'https://neonail.vogt.de.com/',
'https://neonail.vogt.de.com/login'
];
foreach ($testLinks as $link) {
echo " 🔗 $link\n";
}
// 8. Debug-Anleitung
echo "\n8. 🔍 Debug-Anleitung...\n";
echo " 📋 1. Öffnen Sie: https://neonail.vogt.de.com\n";
echo " 📋 2. Melden Sie sich an\n";
echo " 📋 3. Öffnen Sie Browser-Entwicklertools (F12)\n";
echo " 📋 4. Gehen Sie zu Console-Tab\n";
echo " 📋 5. Klicken Sie auf Ihren Benutzernamen\n";
echo " 📋 6. Wählen Sie 'Abmelden'\n";
echo " 📋 7. Schauen Sie nach JavaScript-Fehlern\n";
echo " 📋 8. Gehen Sie zu Network-Tab\n";
echo " 📋 9. Schauen Sie welche URL aufgerufen wird\n";
echo " 📋 10. Testen Sie direkt: https://neonail.vogt.de.com/logout\n";
echo "\n✅ Detailliertes Logout-Debug abgeschlossen!\n";
echo "🔗 Testen Sie jetzt:\n";
echo "1. Das normale Logout über das Dropdown\n";
echo "2. Den direkten Link: https://neonail.vogt.de.com/logout\n";
echo "3. Teilen Sie alle Fehlermeldungen mit\n";
?>