diff --git a/Config.php b/Config.php index 867a243..87aba80 100644 --- a/Config.php +++ b/Config.php @@ -1,12 +1,12 @@ connect_error) { +if (!$conn) { die("Koneksi gagal: " . mysqli_connect_error()); } ?> diff --git a/auth.php b/auth.php index 40f6f6d..467505c 100644 --- a/auth.php +++ b/auth.php @@ -10,32 +10,31 @@ if (isset($_POST['btn-register'])) { $username = $_POST['username']; $email = $_POST['email']; $password = $_POST['password']; - // Pastikan di HTML name-nya sudah 'confirm_password' $confirm = $_POST['confirm_password']; // --- 1. VALIDASI DATA --- // Cek Kosong if (empty($username) || empty($email) || empty($password) || empty($confirm)) { - echo ""; + echo ""; exit; } // Cek Format Email (Biar gak ngawur) if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { - echo ""; + echo ""; exit; } // Cek Panjang Password (Minimal 6) if (strlen($password) < 6) { - echo ""; + echo ""; exit; } // Cek Kesamaan Password if ($password !== $confirm) { - echo ""; + echo ""; exit; } @@ -46,7 +45,7 @@ if (isset($_POST['btn-register'])) { mysqli_stmt_store_result($stmt); if (mysqli_stmt_num_rows($stmt) > 0) { - echo ""; + echo ""; exit; } mysqli_stmt_close($stmt); @@ -57,7 +56,7 @@ if (isset($_POST['btn-register'])) { mysqli_stmt_bind_param($stmtInsert, "sss", $username, $email, $hashed_password); if (mysqli_stmt_execute($stmtInsert)) { - echo ""; + echo ""; } else { echo "Error: " . mysqli_error($conn); } @@ -83,7 +82,7 @@ else if (isset($_POST['btn-login'])) { // JIKA GAGAL if (!$row || !password_verify($password, $row['password'])) { // Kirim sinyal error ke HTML (Kotak Merah) - header("Location: index.html?error=gagal"); + header("Location: index.php?error=gagal"); exit; } diff --git a/index.php b/index.php index 84d0459..bad5891 100644 --- a/index.php +++ b/index.php @@ -5,7 +5,7 @@