/** * Login System Test * Login sisteminin tüm bileşenlerini test eder * KULLANDIKTAN SONRA SİLİN! */ error_reporting(E_ALL); ini_set('display_errors', 1); echo "

🔐 Login System Test

"; echo "
"; // Test credentials $test_username = 'd3lishey'; $test_password = 'k3l3m3nali331!'; $test_hash = '$2a$12$yB0M/2IRu62PcUnYr4R6/OyTLDm2mKjaoenEDZIEr546hI0wrrIee'; echo "

📋 Test Credentials:

"; echo ""; echo "
"; // Test 1: Password verification echo "

1️⃣ Password Hash Test

"; $verify_result = password_verify($test_password, $test_hash); if ($verify_result) { echo "
"; echo "

✅ Password verification SUCCESSFUL!

"; echo "

password_verify() returned TRUE

"; echo "
"; } else { echo "
"; echo "

❌ Password verification FAILED!

"; echo "

password_verify() returned FALSE

"; echo "

This means the hash doesn't match the password!

"; echo "
"; } echo "
"; // Test 2: Config file echo "

2️⃣ Config File Test

"; $config_path = __DIR__ . '/includes/config.php'; if (file_exists($config_path)) { echo "
"; echo "

✅ config.php exists!

"; echo "

Path: $config_path

"; echo "
"; // Try to include it echo "

Testing config.php include...

"; define('BOOKING_SYSTEM', true); try { require_once $config_path; echo "
"; echo "

✅ config.php loaded successfully!

"; echo ""; echo "
"; } catch (Exception $e) { echo "
"; echo "

❌ config.php error!

"; echo "

" . htmlspecialchars($e->getMessage()) . "

"; echo "
"; } } else { echo "
"; echo "

❌ config.php NOT FOUND!

"; echo "

Expected path: $config_path

"; echo "
"; } echo "
"; // Test 3: Database connection via config if (defined('DB_HOST')) { echo "

3️⃣ Database Connection Test (via config)

"; try { $dsn = "mysql:host=" . DB_HOST . ";dbname=" . DB_NAME . ";charset=utf8mb4"; $pdo = new PDO($dsn, DB_USER, DB_PASS, [ PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, ]); echo "
"; echo "

✅ Database connection SUCCESSFUL!

"; echo "
"; // Check admin user echo "

Checking admin user...

"; $stmt = $pdo->prepare("SELECT * FROM admins WHERE username = ?"); $stmt->execute([$test_username]); $admin = $stmt->fetch(); if ($admin) { echo "
"; echo "

✅ User found in database!

"; echo ""; echo "
"; // Verify password against DB hash echo "

Testing password against DB hash...

"; $db_verify = password_verify($test_password, $admin['password_hash']); if ($db_verify) { echo "
"; echo "

✅ PASSWORD MATCHES DATABASE HASH!

"; echo "

Login should work!

"; echo "
"; } else { echo "
"; echo "

❌ PASSWORD DOES NOT MATCH DATABASE HASH!

"; echo "

This is the problem! Update the password hash in database.

"; echo "
"; } } else { echo "
"; echo "

❌ User NOT found in database!

"; echo "

User '$test_username' does not exist!

"; echo "
"; } } catch (PDOException $e) { echo "
"; echo "

❌ Database connection FAILED!

"; echo "

" . htmlspecialchars($e->getMessage()) . "

"; echo "
"; } } echo "
"; // Test 4: Session echo "

4️⃣ Session Test

"; if (session_status() === PHP_SESSION_NONE) { session_start(); echo "
"; echo "

✅ Session started successfully!

"; echo "
"; } else { echo "
"; echo "

ℹ️ Session already active!

"; echo "
"; } echo "
"; // Test 5: File permissions echo "

5️⃣ File Permissions Test

"; $files_to_check = [ 'includes/config.php', 'admin/login.php', 'logs/', 'logs/error.log', ]; echo ""; echo ""; foreach ($files_to_check as $file) { $path = __DIR__ . '/' . $file; $exists = file_exists($path); $readable = is_readable($path); $writable = is_writable($path); echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; } echo "
File/FolderExistsReadableWritable
$file" . ($exists ? '✅' : '❌') . "" . ($readable ? '✅' : '❌') . "" . ($writable ? '✅' : '❌') . "
"; echo "
"; echo "
"; echo "

⚠️ IMPORTANT!

"; echo "

DELETE THIS FILE AFTER TESTING!

"; echo "

This file contains sensitive information and should not be accessible in production.

"; echo "
"; ?>