<?php
require_once('koneksi.php');

$username_form = "muari123"; // Ganti dengan username yang Anda coba login

echo "<h2>Cek Database:</h2>";
$query = mysqli_query($koneksi, "SELECT * FROM users WHERE username = '$username_form'");

if (!$query) {
    die("Query Error: " . mysqli_error($koneksi));
}

if (mysqli_num_rows($query) > 0) {
    echo "User '$username_form' DITEMUKAN!<br>";
    $d = mysqli_fetch_array($query);
    echo "ID User: " . $d['id_user'] . "<br>";
    echo "Password di DB: " . $d['password'] . "<br>";
} else {
    echo "User '$username_form' TIDAK DITEMUKAN!<br>";
    echo "Mari kita lihat semua data di tabel users:<br>";
    $all = mysqli_query($koneksi, "SELECT username FROM users");
    while($r = mysqli_fetch_array($all)) {
        echo "- Username: [" . $r['username'] . "] (Panjang: " . strlen($r['username']) . ")<br>";
    }
}
?>