From 89f19e87f3baf4600b09dd5c1a30f6f4738f2a5b Mon Sep 17 00:00:00 2001 From: Nathan Date: Sun, 14 Dec 2025 21:45:38 +0700 Subject: [PATCH] commencing warcrime by moving the file into xampp/htdocs --- .vscode/launch.json | 15 ++++ auth.php | 53 ++++++++------ index.html | 169 ++++++++++++++++++++++++++++---------------- 3 files changed, 155 insertions(+), 82 deletions(-) create mode 100644 .vscode/launch.json diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..2ba986f --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,15 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "chrome", + "request": "launch", + "name": "Launch Chrome against localhost", + "url": "http://localhost:8080", + "webRoot": "${workspaceFolder}" + } + ] +} \ No newline at end of file diff --git a/auth.php b/auth.php index ac25f22..40f6f6d 100644 --- a/auth.php +++ b/auth.php @@ -1,50 +1,62 @@ alert('Semua data harus diisi!'); window.location='index.html';"; + echo ""; exit; } - // Validasi password match + // Cek Format Email (Biar gak ngawur) + if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { + echo ""; + exit; + } + + // Cek Panjang Password (Minimal 6) + if (strlen($password) < 6) { + echo ""; + exit; + } + + // Cek Kesamaan Password if ($password !== $confirm) { echo ""; exit; } - // Cek Username/Email sudah ada atau belum + // --- 2. CEK DUPLIKAT DI DATABASE --- $stmt = mysqli_prepare($conn, "SELECT id FROM users WHERE username = ? OR email = ?"); mysqli_stmt_bind_param($stmt, "ss", $username, $email); mysqli_stmt_execute($stmt); mysqli_stmt_store_result($stmt); if (mysqli_stmt_num_rows($stmt) > 0) { - echo ""; - exit; // Stop di sini + echo ""; + exit; } mysqli_stmt_close($stmt); - // Hash password & Insert + // --- 3. SIMPAN DATA --- $hashed_password = password_hash($password, PASSWORD_DEFAULT); $stmtInsert = mysqli_prepare($conn, "INSERT INTO users (username, email, password) VALUES (?, ?, ?)"); mysqli_stmt_bind_param($stmtInsert, "sss", $username, $email, $hashed_password); if (mysqli_stmt_execute($stmtInsert)) { - // Balik ke index.html tapi kasih pesan sukses echo ""; } else { echo "Error: " . mysqli_error($conn); @@ -68,23 +80,18 @@ else if (isset($_POST['btn-login'])) { $result = mysqli_stmt_get_result($stmt); $row = mysqli_fetch_assoc($result); - // Cek user ada ATAU password salah + // JIKA GAGAL if (!$row || !password_verify($password, $row['password'])) { - echo ""; + // Kirim sinyal error ke HTML (Kotak Merah) + header("Location: index.html?error=gagal"); exit; } - // Login Sukses + // JIKA SUKSES $_SESSION['username'] = $row['username']; $_SESSION['login'] = true; - echo ""; + header("Location: mainboard.html"); exit; } ?> \ No newline at end of file diff --git a/index.html b/index.html index e0609d9..58a3d15 100644 --- a/index.html +++ b/index.html @@ -11,7 +11,7 @@ body { margin: 0; - font-family: Arial, sans-serif; + font-family: 'Segoe UI', Arial, sans-serif; background: linear-gradient(135deg, #d9a7ff, #fbc2eb, #a1c4fd); min-height: 100vh; display: flex; @@ -20,17 +20,17 @@ body { overflow-x: hidden; } -/* --- 2. CONTAINER KARTU --- */ +/* --- 2. CONTAINER KARTU (DENGAN ANIMASI RESIZE) --- */ .auth-card { width: 380px; - background: rgba(255, 255, 255, 0.9); /* Dibuat lebih solid sedikit */ + background: rgba(255, 255, 255, 0.95); backdrop-filter: blur(12px); border-radius: 25px; box-shadow: 0 10px 30px rgba(0,0,0,0.2); overflow: hidden; position: relative; z-index: 10; - /* Animasi Tinggi agar mulus saat resize */ + /* PENTING: Transisi halus saat tinggi berubah */ transition: height 0.4s cubic-bezier(0.25, 1, 0.5, 1); } @@ -38,31 +38,27 @@ body { width: 100%; } -/* --- PERBAIKAN UTAMA ADA DI SINI --- */ .forms-container { display: flex; - width: 200%; + width: 200%; /* Lebar 200% untuk menampung Login & Register berdampingan */ transition: transform 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55); - /* PENTING: Agar form Login tidak dipaksa setinggi form Register */ align-items: flex-start; } .auth-card.active .forms-container { - transform: translateX(-50%); + transform: translateX(-50%); /* Geser ke kiri untuk menampilkan Register */ } -/* --- 3. STYLING FORM INDIVIDUAL --- */ +/* --- 3. STYLING FORM --- */ form { width: 50%; flex-shrink: 0; - padding: 40px; /* Padding ini menentukan jarak dalam */ + padding: 40px; display: flex; flex-direction: column; align-items: center; - /* Hapus justify-content: center agar tinggi dihitung dari konten asli */ } -/* Typography & Inputs */ h2 { margin: 0 0 10px; text-align: center; @@ -105,14 +101,28 @@ input:focus { outline: none; border-color: purple; background: #fff; box-shadow: .switch-text a { color: purple; text-decoration: none; font-weight: bold; cursor: pointer; } .switch-text a:hover { text-decoration: underline; } -/* Error Box */ +/* --- ERROR BOX (KOTAK MERAH) --- */ .error-box { - width: 100%; color: #d8000c; background: #ffbaba; - padding: 10px; border-radius: 10px; margin-bottom: 15px; - font-size: 13px; text-align: center; display: none; + width: 100%; + color: #d8000c; + background: #ffbaba; + border: 1px solid #ff7675; + padding: 12px; + border-radius: 10px; + margin-bottom: 20px; + font-size: 13px; + text-align: center; + display: none; /* Default sembunyi */ + font-weight: bold; + animation: fadeIn 0.3s; } -/* Dekorasi (Buah & Glitter) */ +@keyframes fadeIn { + from { opacity: 0; transform: translateY(-10px); } + to { opacity: 1; transform: translateY(0); } +} + +/* Dekorasi Buah */ .fruit { position: absolute; width: 90px; opacity: 0.85; animation: float 6s infinite ease-in-out, drift 15s infinite linear; pointer-events: none; z-index: 1; } .f1 { top: 8%; left: 10%; width: 80px; } .f2 { top: 65%; right: 12%; } .f3 { top: 22%; right: 55%; width: 60px; } .f4 { bottom: 15%; left: 28%; } .f5 { bottom: 10%; right: 30%; width: 70px; } .f6 { top: 40%; left: 50%; } @@ -120,6 +130,8 @@ input:focus { outline: none; border-color: purple; background: #fff; box-shadow: .f10 { bottom: 20%; right: 5%; } @keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-20px) rotate(6deg); } } @keyframes drift { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(15px); } } + +/* Glitter */ .glitter { position: absolute; width: 4px; height: 4px; background: purple; border-radius: 50%; opacity: 0; animation: glitter-burst 2s infinite ease-out; pointer-events: none; z-index: 11; } @keyframes glitter-burst { 0% { transform: scale(0.4); opacity: 0.9; } 100% { transform: scale(1) translate(var(--x), var(--y)); opacity: 0; } } @@ -172,7 +184,6 @@ input:focus { outline: none; border-color: purple; background: #fff; box-shadow: -

@@ -185,24 +196,27 @@ input:focus { outline: none; border-color: purple; background: #fff; box-shadow: