Current directory: /home/klas4s23/domains/585455.klas4s23.mid-ica.nl/public_html/Gastenboek/uploads
<?php
/**
* Test Password Verification
* This helps debug login issues
*/
header('Content-Type: application/json');
require_once 'config.php';
try {
$pdo = getDbConnection();
// Get demo user
$stmt = $pdo->prepare("SELECT username, password_hash FROM users WHERE username = 'demo'");
$stmt->execute();
$user = $stmt->fetch();
if (!$user) {
echo json_encode(['error' => 'Demo user not found']);
exit;
}
// Test password
$test_password = 'demo123';
$verify = password_verify($test_password, $user['password_hash']);
echo json_encode([
'username' => $user['username'],
'password_tested' => $test_password,
'hash_preview' => substr($user['password_hash'], 0, 30) . '...',
'verification_result' => $verify ? 'SUCCESS ✓' : 'FAILED ✗',
'message' => $verify ? 'Password is correct!' : 'Password does not match hash'
], JSON_PRETTY_PRINT);
} catch (Exception $e) {
echo json_encode(['error' => $e->getMessage()]);
}