diff --git a/login.html b/login.html new file mode 100644 index 0000000..692d2e6 --- /dev/null +++ b/login.html @@ -0,0 +1,404 @@ + + + + + +Login + + + + + + + +
+
+
+
+
+ + + + + + + + + + + + + +
+
+
+
+
+
+

Selamat Datang! ✨

+

Login untuk bermain Memory Flip Card Game

+
+ +
+ + + + + + +
+ + +
+ +

+ Belum punya akun? + Daftar Sekarang +

+ + + + + + \ No newline at end of file diff --git a/login.php b/login.php new file mode 100644 index 0000000..8b2a96e --- /dev/null +++ b/login.php @@ -0,0 +1,40 @@ + + alert('Username atau Password salah!'); + window.location.href='index.html'; + "; + exit; + } + + // Login sukses + $_SESSION['username'] = $row['username']; + $_SESSION['login'] = true; // Tambahan untuk cek status login nanti + + // PERBAIKAN 3: Arahkan ke file game kamu (sesuaikan nama filenya) + // Di screenshot ada mainboard.html, pakai itu. + echo ""; + exit; +} +?> \ No newline at end of file diff --git a/register.html b/register.html new file mode 100644 index 0000000..335a183 --- /dev/null +++ b/register.html @@ -0,0 +1,321 @@ + + + + + + Register Akun + + + + + + +
+ + + + + + + + + + + +
+
+
+ +

Buat Akun Baru ✨

+

Daftar untuk bermain Memory Card Game

+ +
+ + + + + + + + + + + + +
+ + +
+ + +
+
+ + + + + diff --git a/register.php b/register.php new file mode 100644 index 0000000..53fced8 --- /dev/null +++ b/register.php @@ -0,0 +1,46 @@ +alert('Semua data harus diisi!'); window.location='index.html';"; + exit; + } + + if ($password !== $confirm) { + echo ""; + exit; + } + + // Cek Username/Email di tabel 'users' + $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; + } + mysqli_stmt_close($stmt); + + $hashed_password = password_hash($password, PASSWORD_DEFAULT); + + // Insert ke tabel 'users' + $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)) { + echo ""; + } else { + echo "Error: " . mysqli_error($conn); + } + mysqli_stmt_close($stmtInsert); +} +?> \ No newline at end of file