From 6e9b68bb36e563eb974c47878ea211220dedbd2c Mon Sep 17 00:00:00 2001 From: Hamza-Ayed Date: Fri, 1 May 2026 01:00:33 +0300 Subject: [PATCH] admin 14 --- Admin/auth/debug_login.php | 74 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 Admin/auth/debug_login.php diff --git a/Admin/auth/debug_login.php b/Admin/auth/debug_login.php new file mode 100644 index 0000000..57ee58d --- /dev/null +++ b/Admin/auth/debug_login.php @@ -0,0 +1,74 @@ +getMessage() . ' in ' . $e->getFile() . ':' . $e->getLine(); +} + +// 3. التحقق من الدوال المطلوبة +$checks['filterRequest_exists'] = function_exists('filterRequest'); +$checks['jsonError_exists'] = function_exists('jsonError'); +$checks['sendWhatsAppFromServer_exists'] = function_exists('sendWhatsAppFromServer'); + +// 4. التحقق من قاعدة البيانات +try { + $con = Database::get('main'); + $checks['db_connected'] = true; + + // التحقق من بنية الجدول + $stmt = $con->query("DESCRIBE adminUser"); + $columns = $stmt->fetchAll(PDO::FETCH_COLUMN); + $checks['adminUser_columns'] = $columns; + + // هل يوجد جدول token_verification_admin؟ + $stmt2 = $con->query("SHOW TABLES LIKE 'token_verification_admin'"); + $checks['token_verification_admin_exists'] = $stmt2->rowCount() > 0; + + if (!$checks['token_verification_admin_exists']) { + $checks['CRITICAL'] = 'Table token_verification_admin does NOT exist! This is why login fails.'; + } +} catch (Throwable $e) { + $checks['db_connected'] = false; + $checks['db_error'] = $e->getMessage(); +} + +// 5. التحقق من PHP error log الأخير +$logPath = '/home/intaleq-api/logs/php_errors.log'; +if (file_exists($logPath)) { + $lines = file($logPath); + $checks['last_5_errors'] = array_map('trim', array_slice($lines, -5)); +} else { + $logPath2 = __DIR__ . '/../../logs/php_errors.log'; + if (file_exists($logPath2)) { + $lines = file($logPath2); + $checks['last_5_errors'] = array_map('trim', array_slice($lines, -5)); + } else { + $checks['error_log'] = 'Log file not found'; + } +} + +// 6. نسخة PHP +$checks['php_version'] = PHP_VERSION; + +echo json_encode($checks, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);