Resolve merge conflict: remove homestyle.css
This commit is contained in:
commit
d7b3370eb0
15
.vscode/launch.json
vendored
Normal file
15
.vscode/launch.json
vendored
Normal file
@ -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}"
|
||||
}
|
||||
]
|
||||
}
|
||||
12
Config.php
Normal file
12
Config.php
Normal file
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
$host = "localhost";
|
||||
$user = "root";
|
||||
$password = "";
|
||||
$database = "users_db";
|
||||
|
||||
$conn = mysqli_connect($host, $user, $password, $database);
|
||||
|
||||
if ($conn->connect_error) {
|
||||
die("Koneksi gagal: " . mysqli_connect_error());
|
||||
}
|
||||
?>
|
||||
178
Leaderboard.html
Normal file
178
Leaderboard.html
Normal file
@ -0,0 +1,178 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="id">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Leaderboard</title>
|
||||
|
||||
<style>
|
||||
body {
|
||||
margin: 0;
|
||||
font-family: Arial, sans-serif;
|
||||
background: linear-gradient(135deg, #c42ddf, #fe8bb4);
|
||||
color: white;
|
||||
}
|
||||
|
||||
.topbar {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 15px;
|
||||
}
|
||||
|
||||
.back-btn, .logout-btn {
|
||||
background: white;
|
||||
padding: 8px 15px;
|
||||
border-radius: 20px;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.profile {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.profile-icon {
|
||||
background: #d05dec;
|
||||
width: 35px;
|
||||
height: 35px;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.title {
|
||||
text-align: center;
|
||||
font-size: 32px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
.subtitle {
|
||||
text-align: center;
|
||||
margin-top: -10px;
|
||||
}
|
||||
|
||||
.filter-container {
|
||||
margin: 20px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.filter-btn {
|
||||
background: rgba(255,255,255,0.3);
|
||||
border: none;
|
||||
padding: 8px 20px;
|
||||
border-radius: 20px;
|
||||
cursor: pointer;
|
||||
color: white;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.filter-btn.active {
|
||||
background: white;
|
||||
color: #000000;
|
||||
}
|
||||
le {
|
||||
width: 95%;
|
||||
margin: auto;
|
||||
border-collapse: collapse;
|
||||
background: rgba(255,255,255,0.15);
|
||||
border-radius: 10px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
th, td {
|
||||
padding: 12px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
thead {
|
||||
background: rgba(255,255,255,0.2);
|
||||
}
|
||||
|
||||
.tag {
|
||||
padding: 4px 10px;
|
||||
border-radius: 12px;
|
||||
font-size: 13px;
|
||||
color: black;
|
||||
}
|
||||
.hard { background: #ff6b6b; }
|
||||
.medium { background: #ffe86a; }
|
||||
.easy { background: #7ddf8c; }
|
||||
|
||||
.cards {
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
margin: 40px 20px;
|
||||
}
|
||||
|
||||
.card {
|
||||
width: 28%;
|
||||
padding: 20px;
|
||||
background: rgba(255,255,255,0.25);
|
||||
text-align: center;
|
||||
border-radius: 15px;
|
||||
}
|
||||
|
||||
.card h2 {
|
||||
color: rgb(255, 0, 0);
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="topbar">
|
||||
<button class="back-btn" onclick="window.location.href='mainboard.html'">← Kembali</button>
|
||||
<button class="logout-btn">Logout</button>
|
||||
</div>
|
||||
|
||||
<h1 class="title">🏆 Leaderboard</h1>
|
||||
<p class="subtitle"> Top skor dari semua pemain</p>
|
||||
|
||||
|
||||
<div class="filter-container">
|
||||
<span>Filter:</span>
|
||||
<button class="filter-btn active">Semua</button>
|
||||
<button class="filter-btn easy">Easy</button>
|
||||
<button class="filter-btn medium">Medium</button>
|
||||
<button class="filter-btn hard">Hard</button>
|
||||
</div>
|
||||
|
||||
<div class="cards">
|
||||
<div class="card">
|
||||
🎮
|
||||
<p><div class="count"><span>Total Game Dimainkan</span></p>
|
||||
<span id="game-count">0</span></div></p>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
👑
|
||||
<p><div class="count"><span>Top Player</span></p>
|
||||
<span id="player-rank">0</span></div></p>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
⭐
|
||||
<p><div class="count"><span>Skor Tertinggi</span></p>
|
||||
<span id="baseScoreEnd">0</span></div></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
const buttons = document.querySelectorAll(".filter-btn");
|
||||
buttons.forEach(btn => {
|
||||
btn.addEventListener("click", function () {
|
||||
buttons.forEach(b => b.classList.remove("active"));
|
||||
this.classList.add("active");
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
97
auth.php
Normal file
97
auth.php
Normal file
@ -0,0 +1,97 @@
|
||||
<?php
|
||||
session_start();
|
||||
require_once "Config.php";
|
||||
|
||||
// ==========================================
|
||||
// BAGIAN 1: LOGIKA REGISTER
|
||||
// ==========================================
|
||||
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 "<script>alert('Semua data wajib diisi!'); window.location='index.html';</script>";
|
||||
exit;
|
||||
}
|
||||
|
||||
// Cek Format Email (Biar gak ngawur)
|
||||
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
|
||||
echo "<script>alert('Format email tidak valid! (contoh: nama@email.com)'); window.location='index.html';</script>";
|
||||
exit;
|
||||
}
|
||||
|
||||
// Cek Panjang Password (Minimal 6)
|
||||
if (strlen($password) < 6) {
|
||||
echo "<script>alert('Password terlalu pendek! Minimal 6 karakter.'); window.location='index.html';</script>";
|
||||
exit;
|
||||
}
|
||||
|
||||
// Cek Kesamaan Password
|
||||
if ($password !== $confirm) {
|
||||
echo "<script>alert('Password dan Konfirmasi tidak cocok!'); window.location='index.html';</script>";
|
||||
exit;
|
||||
}
|
||||
|
||||
// --- 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 "<script>alert('Username atau Email sudah terpakai! Ganti yang lain.'); window.location='index.html';</script>";
|
||||
exit;
|
||||
}
|
||||
mysqli_stmt_close($stmt);
|
||||
|
||||
// --- 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)) {
|
||||
echo "<script>alert('Registrasi Berhasil! Silakan Login.'); window.location='index.html';</script>";
|
||||
} else {
|
||||
echo "Error: " . mysqli_error($conn);
|
||||
}
|
||||
mysqli_stmt_close($stmtInsert);
|
||||
|
||||
}
|
||||
|
||||
// ==========================================
|
||||
// BAGIAN 2: LOGIKA LOGIN
|
||||
// ==========================================
|
||||
else if (isset($_POST['btn-login'])) {
|
||||
|
||||
$username = $_POST['username'];
|
||||
$password = $_POST['password'];
|
||||
|
||||
$stmt = mysqli_prepare($conn, "SELECT * FROM users WHERE username=?");
|
||||
mysqli_stmt_bind_param($stmt, "s", $username);
|
||||
mysqli_stmt_execute($stmt);
|
||||
|
||||
$result = mysqli_stmt_get_result($stmt);
|
||||
$row = mysqli_fetch_assoc($result);
|
||||
|
||||
// JIKA GAGAL
|
||||
if (!$row || !password_verify($password, $row['password'])) {
|
||||
// Kirim sinyal error ke HTML (Kotak Merah)
|
||||
header("Location: index.html?error=gagal");
|
||||
exit;
|
||||
}
|
||||
|
||||
// JIKA SUKSES
|
||||
$_SESSION['username'] = $row['username'];
|
||||
$_SESSION['login'] = true;
|
||||
|
||||
header("Location: mainboard.html");
|
||||
exit;
|
||||
}
|
||||
?>
|
||||
162
home.html
162
home.html
@ -4,7 +4,155 @@
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Login Memory Cards</title>
|
||||
<link rel="stylesheet" href="homestyle.css" />
|
||||
<style>
|
||||
/* === BACKGROUND === */
|
||||
body {
|
||||
margin: 0;
|
||||
font-family: Poppins, Arial, sans-serif;
|
||||
height: 100vh;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
|
||||
/* Pink → Ungu Gradient */
|
||||
background: linear-gradient(135deg, #ff9ed1, #d784ff);
|
||||
}
|
||||
|
||||
/* === ANIMATED FLOATING FRUITS === */
|
||||
.fruit {
|
||||
position: absolute;
|
||||
width: 95px;
|
||||
opacity: 0.85;
|
||||
animation: float 7s infinite ease-in-out;
|
||||
pointer-events: none; /* supaya tidak ganggu klik */
|
||||
filter: drop-shadow(0 4px 6px rgba(0,0,0,0.12));
|
||||
}
|
||||
|
||||
/* Posisi lebih seimbang & tidak menutupi teks */
|
||||
.f1 { top: 6%; left: 12%; animation-delay: .3s; }
|
||||
.f2 { top: 12%; right: 18%; animation-delay: 1.2s; }
|
||||
.f3 { top: 48%; right: 8%; animation-delay: .7s; }
|
||||
.f4 { top: 72%; left: 20%; animation-delay: 1.6s; }
|
||||
.f5 { top: 28%; left: 60%; animation-delay: .5s; }
|
||||
.f6 { top: 68%; right: 22%; animation-delay: 1s; }
|
||||
.f7 { top: 40%; left: 10%; animation-delay: .9s; }
|
||||
.f8 { top: 82%; left: 70%; animation-delay: 1.4s; }
|
||||
.f9 { top: 18%; right: 46%; animation-delay: .6s; }
|
||||
.f10 { top: 80%; right: 10%; animation-delay: 1.8s; }
|
||||
|
||||
/* Smooth floating animation */
|
||||
@keyframes float {
|
||||
0% { transform: translateY(0) rotate(0deg); }
|
||||
50% { transform: translateY(-18px) rotate(6deg); }
|
||||
100% { transform: translateY(0) rotate(0deg); }
|
||||
}
|
||||
|
||||
@keyframes drift {
|
||||
0% { transform: translateX(0); }
|
||||
50% { transform: translateX(22px); }
|
||||
100% { transform: translateX(0); }
|
||||
}
|
||||
|
||||
.fruit {
|
||||
width: clamp(70px, 7vw, 105px);
|
||||
}
|
||||
|
||||
/* === CENTRAL CONTAINER === */
|
||||
.container {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* === TITLE WITH GLOW ANIMATION === */
|
||||
.title {
|
||||
font-size: 70px;
|
||||
font-weight: 900;
|
||||
color: #ffffff;
|
||||
line-height: 0.9;
|
||||
text-shadow:
|
||||
0 0 10px #ab2cff,
|
||||
0 0 25px #ff54de,
|
||||
0 0 35px #a639ff;
|
||||
|
||||
animation: glow 2s infinite alternate;
|
||||
}
|
||||
|
||||
@keyframes glow {
|
||||
0% {
|
||||
text-shadow:
|
||||
0 0 10px #ab2cff,
|
||||
0 0 25px #ff54de,
|
||||
0 0 40px #a639ff;
|
||||
}
|
||||
100% {
|
||||
text-shadow:
|
||||
0 0 20px #ffb3f9,
|
||||
0 0 45px #ff7df3,
|
||||
0 0 60px #bb5bff;
|
||||
}
|
||||
}
|
||||
|
||||
/* === BUTTONS === */
|
||||
.btn {
|
||||
width: 260px;
|
||||
padding: 18px 0;
|
||||
font-size: 22px;
|
||||
font-weight: bold;
|
||||
border: none;
|
||||
border-radius: 40px;
|
||||
cursor: pointer;
|
||||
background: linear-gradient(45deg, purple, hotpink);
|
||||
box-shadow: 0 6px 0 rgb(90, 1, 90);
|
||||
transition: transform .2s ease-in-out;
|
||||
color: white;
|
||||
}
|
||||
|
||||
/* === BUTTON SHAKE ON HOVER === */
|
||||
.btn:hover {
|
||||
animation: shake 0.4s ease-in-out;
|
||||
}
|
||||
|
||||
@keyframes shake {
|
||||
0% { transform: translateX(0); }
|
||||
25% { transform: translateX(-3px); }
|
||||
50% { transform: translateX(3px); }
|
||||
75% { transform: translateX(-2px); }
|
||||
100% { transform: translateX(0); }
|
||||
}
|
||||
|
||||
/* === OR LINE === */
|
||||
.or-line {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin: 25px 0;
|
||||
}
|
||||
|
||||
.line {
|
||||
width: 80px;
|
||||
height: 2px;
|
||||
background: rgba(255,255,255,0.8);
|
||||
}
|
||||
|
||||
.or-line span {
|
||||
margin: 0 10px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/* === HOW TO PLAY === */
|
||||
.how {
|
||||
margin-top: 5px;
|
||||
font-size: 22px;
|
||||
color: #fff;
|
||||
opacity: 0.9;
|
||||
padding: 2px 0;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.hidden { display: none !important;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@ -35,5 +183,15 @@
|
||||
<button class="btn how-to-play">❓ Cara bermain</button>
|
||||
</div>
|
||||
</body>
|
||||
<script src="home.js"></script>
|
||||
<script>
|
||||
|
||||
function goToLoginCard() {
|
||||
document.querySelector(".memory").classList.add("hidden");
|
||||
document.querySelector(".login-wrapper").classList.remove("hidden");
|
||||
}
|
||||
function goToLoginCard() {
|
||||
window.location.href = "login.html"; // atau page tujuan lain
|
||||
}
|
||||
|
||||
</script>
|
||||
</html>
|
||||
8
home.js
8
home.js
@ -1,8 +0,0 @@
|
||||
function goToLoginCard() {
|
||||
document.querySelector(".memory").classList.add("hidden");
|
||||
document.querySelector(".login-wrapper").classList.remove("hidden");
|
||||
}
|
||||
function goToLoginCard() {
|
||||
window.location.href = "login.html"; // atau page tujuan lain
|
||||
}
|
||||
|
||||
146
homestyle.css
146
homestyle.css
@ -1,146 +0,0 @@
|
||||
/* === BACKGROUND === */
|
||||
body {
|
||||
margin: 0;
|
||||
font-family: Poppins, Arial, sans-serif;
|
||||
height: 100vh;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
background: linear-gradient(135deg, #ff9ed1, #d784ff);
|
||||
}
|
||||
|
||||
/* === ANIMATED FLOATING FRUITS === */
|
||||
.fruit {
|
||||
position: absolute;
|
||||
width: 95px;
|
||||
opacity: 0.85;
|
||||
animation: float 7s infinite ease-in-out;
|
||||
pointer-events: none; /* supaya tidak ganggu klik */
|
||||
filter: drop-shadow(0 4px 6px rgba(0,0,0,0.12));
|
||||
}
|
||||
|
||||
/* Posisi lebih seimbang & tidak menutupi teks */
|
||||
.f1 { top: 6%; left: 12%; animation-delay: .3s; }
|
||||
.f2 { top: 12%; right: 18%; animation-delay: 1.2s; }
|
||||
.f3 { top: 48%; right: 8%; animation-delay: .7s; }
|
||||
.f4 { top: 72%; left: 20%; animation-delay: 1.6s; }
|
||||
.f5 { top: 28%; left: 60%; animation-delay: .5s; }
|
||||
.f6 { top: 68%; right: 22%; animation-delay: 1s; }
|
||||
.f7 { top: 40%; left: 10%; animation-delay: .9s; }
|
||||
.f8 { top: 82%; left: 70%; animation-delay: 1.4s; }
|
||||
.f9 { top: 18%; right: 46%; animation-delay: .6s; }
|
||||
.f10 { top: 80%; right: 10%; animation-delay: 1.8s; }
|
||||
|
||||
/* Smooth floating animation */
|
||||
@keyframes float {
|
||||
0% { transform: translateY(0) rotate(0deg); }
|
||||
50% { transform: translateY(-18px) rotate(6deg); }
|
||||
100% { transform: translateY(0) rotate(0deg); }
|
||||
}
|
||||
|
||||
@keyframes drift {
|
||||
0% { transform: translateX(0); }
|
||||
50% { transform: translateX(22px); }
|
||||
100% { transform: translateX(0); }
|
||||
}
|
||||
|
||||
.fruit {
|
||||
width: clamp(70px, 7vw, 105px);
|
||||
}
|
||||
|
||||
/* === CENTRAL CONTAINER === */
|
||||
.container {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* === TITLE WITH GLOW ANIMATION === */
|
||||
.title {
|
||||
font-size: 70px;
|
||||
font-weight: 900;
|
||||
color: #ffffff;
|
||||
line-height: 0.9;
|
||||
text-shadow:
|
||||
0 0 10px #ab2cff,
|
||||
0 0 25px #ff54de,
|
||||
0 0 35px #a639ff;
|
||||
|
||||
animation: glow 2s infinite alternate;
|
||||
}
|
||||
|
||||
@keyframes glow {
|
||||
0% {
|
||||
text-shadow:
|
||||
0 0 10px #ab2cff,
|
||||
0 0 25px #ff54de,
|
||||
0 0 40px #a639ff;
|
||||
}
|
||||
100% {
|
||||
text-shadow:
|
||||
0 0 20px #ffb3f9,
|
||||
0 0 45px #ff7df3,
|
||||
0 0 60px #bb5bff;
|
||||
}
|
||||
}
|
||||
|
||||
/* === BUTTONS === */
|
||||
.btn {
|
||||
width: 260px;
|
||||
padding: 18px 0;
|
||||
font-size: 22px;
|
||||
font-weight: bold;
|
||||
border: none;
|
||||
border-radius: 40px;
|
||||
cursor: pointer;
|
||||
background: linear-gradient(45deg, purple, hotpink);
|
||||
box-shadow: 0 6px 0 rgb(90, 1, 90);
|
||||
transition: transform .2s ease-in-out;
|
||||
color: white;
|
||||
}
|
||||
|
||||
/* === BUTTON SHAKE ON HOVER === */
|
||||
.btn:hover {
|
||||
animation: shake 0.4s ease-in-out;
|
||||
}
|
||||
|
||||
@keyframes shake {
|
||||
0% { transform: translateX(0); }
|
||||
25% { transform: translateX(-3px); }
|
||||
50% { transform: translateX(3px); }
|
||||
75% { transform: translateX(-2px); }
|
||||
100% { transform: translateX(0); }
|
||||
}
|
||||
|
||||
|
||||
/* === OR LINE === */
|
||||
.or-line {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin: 25px 0;
|
||||
}
|
||||
|
||||
.line {
|
||||
width: 80px;
|
||||
height: 2px;
|
||||
background: rgba(255,255,255,0.8);
|
||||
}
|
||||
|
||||
.or-line span {
|
||||
margin: 0 10px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/* === HOW TO PLAY === */
|
||||
.how {
|
||||
margin-top: 5px;
|
||||
font-size: 22px;
|
||||
color: #fff;
|
||||
opacity: 0.9;
|
||||
padding: 2px 0;
|
||||
cursor: pointer;
|
||||
|
||||
}
|
||||
|
||||
.hidden { display: none !important;
|
||||
}
|
||||
321
index.html
Normal file
321
index.html
Normal file
@ -0,0 +1,321 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="id">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Login & Register - Memory Game</title>
|
||||
|
||||
<style>
|
||||
/* --- 1. RESET & BACKGROUND UTAMA --- */
|
||||
* { box-sizing: border-box; }
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
font-family: 'Segoe UI', Arial, sans-serif;
|
||||
background: linear-gradient(135deg, #d9a7ff, #fbc2eb, #a1c4fd);
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
/* --- 2. CONTAINER KARTU (DENGAN ANIMASI RESIZE) --- */
|
||||
.auth-card {
|
||||
width: 380px;
|
||||
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;
|
||||
/* PENTING: Transisi halus saat tinggi berubah */
|
||||
transition: height 0.4s cubic-bezier(0.25, 1, 0.5, 1);
|
||||
}
|
||||
|
||||
.form-wrapper {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.forms-container {
|
||||
display: flex;
|
||||
width: 200%; /* Lebar 200% untuk menampung Login & Register berdampingan */
|
||||
transition: transform 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55);
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.auth-card.active .forms-container {
|
||||
transform: translateX(-50%); /* Geser ke kiri untuk menampilkan Register */
|
||||
}
|
||||
|
||||
/* --- 3. STYLING FORM --- */
|
||||
form {
|
||||
width: 50%;
|
||||
flex-shrink: 0;
|
||||
padding: 40px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
h2 {
|
||||
margin: 0 0 10px;
|
||||
text-align: center;
|
||||
font-size: 26px;
|
||||
background: linear-gradient(45deg, purple, hotpink);
|
||||
-webkit-background-clip: text;
|
||||
background-clip: text;
|
||||
color: transparent;
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
text-align: center; color: gray; font-size: 14px; margin-bottom: 25px;
|
||||
}
|
||||
|
||||
label {
|
||||
font-size: 14px; color: #444; width: 100%; margin-bottom: 6px; font-weight: bold;
|
||||
}
|
||||
|
||||
input {
|
||||
width: 100%; padding: 12px; border-radius: 12px;
|
||||
border: 2px solid #ccc; background: #fafafa;
|
||||
margin-bottom: 15px; font-size: 14px; transition: 0.3s;
|
||||
}
|
||||
|
||||
input:focus { outline: none; border-color: purple; background: #fff; box-shadow: 0 0 8px rgba(128, 0, 128, 0.1); }
|
||||
|
||||
/* Tombol */
|
||||
.btn-submit {
|
||||
width: 100%; padding: 14px;
|
||||
background: linear-gradient(45deg, purple, hotpink);
|
||||
color: white; border-radius: 15px; border: none;
|
||||
cursor: pointer; font-size: 16px; font-weight: bold;
|
||||
transition: 0.25s ease; margin-top: 10px;
|
||||
box-shadow: 0 4px 15px rgba(128, 0, 128, 0.2);
|
||||
}
|
||||
.btn-submit:hover { transform: scale(1.02); }
|
||||
|
||||
/* Link Switch */
|
||||
.switch-text { margin-top: 20px; font-size: 14px; color: #555; }
|
||||
.switch-text a { color: purple; text-decoration: none; font-weight: bold; cursor: pointer; }
|
||||
.switch-text a:hover { text-decoration: underline; }
|
||||
|
||||
/* --- ERROR BOX (KOTAK MERAH) --- */
|
||||
.error-box {
|
||||
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;
|
||||
}
|
||||
|
||||
@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%; }
|
||||
.f7 { bottom: 30%; left: 15%; width: 50px; } .f8 { top: 75%; right: 40%; } .f9 { top: 50%; left: 80%; width: 85px; }
|
||||
.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; } }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<img src="images/fruit1.png" class="fruit f1"><img src="images/fruit2.png" class="fruit f2">
|
||||
<img src="images/fruit3.png" class="fruit f3"><img src="images/fruit4.png" class="fruit f4">
|
||||
<img src="images/fruit5.png" class="fruit f5"><img src="images/fruit6.png" class="fruit f6">
|
||||
<img src="images/fruit7.png" class="fruit f7"><img src="images/fruit8.png" class="fruit f8">
|
||||
<img src="images/fruit9.png" class="fruit f9"><img src="images/fruit10.png" class="fruit f10">
|
||||
|
||||
<div class="auth-card" id="authCard">
|
||||
<div class="form-wrapper">
|
||||
<div class="forms-container">
|
||||
|
||||
<form id="loginForm" action="auth.php" method="POST">
|
||||
<h2>Selamat Datang! ✨</h2>
|
||||
<p class="subtitle">Login untuk bermain</p>
|
||||
|
||||
<div id="loginError" class="error-box"></div>
|
||||
|
||||
<label>Username</label>
|
||||
<input type="text" id="loginUser" name="username" placeholder="Masukan Username" required>
|
||||
|
||||
<label>Password</label>
|
||||
<input type="password" id="loginPass" name="password" placeholder="Masukan Password" required>
|
||||
|
||||
<button type="submit" class="btn-submit" name="btn-login">Login Sekarang</button>
|
||||
|
||||
<p class="switch-text">
|
||||
Belum punya akun? <a onclick="toggleAuth('register')">Daftar Sekarang</a>
|
||||
</p>
|
||||
</form>
|
||||
|
||||
<form id="registerForm" action="auth.php" method="POST">
|
||||
<h2>Buat Akun Baru ✨</h2>
|
||||
<p class="subtitle">Daftar petualangan baru</p>
|
||||
|
||||
<div id="regError" class="error-box"></div>
|
||||
|
||||
<label>Username</label>
|
||||
<input type="text" id="regUser" name="username" placeholder="Pilih Username" required>
|
||||
|
||||
<label>Email</label>
|
||||
<input type="email" id="regEmail" name="email" placeholder="Masukan Email" required>
|
||||
|
||||
<label>Password</label>
|
||||
<input type="password" id="regPass" name="password" placeholder="Minimal 6 karakter" required>
|
||||
|
||||
<label>Konfirmasi Password</label>
|
||||
<input type="password" id="regConfirm" name="confirm_password" placeholder="Ulangi Password" required>
|
||||
<button type="submit" class="btn-submit" name="btn-register">Daftar Sekarang</button>
|
||||
|
||||
<p class="switch-text">
|
||||
Sudah punya akun? <a onclick="toggleAuth('login')">Login Sekarang</a>
|
||||
</p>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
/* LOGIC JAVASCRIPT UTAMA
|
||||
Menghubungkan PHP Error -> Tampilan Kotak Merah & Resize & Validasi
|
||||
*/
|
||||
|
||||
const card = document.getElementById("authCard");
|
||||
const loginForm = document.getElementById("loginForm");
|
||||
const registerForm = document.getElementById("registerForm");
|
||||
|
||||
// 1. FUNGSI MENGATUR TINGGI (RESIZE OTOMATIS)
|
||||
function setHeight() {
|
||||
const isActive = card.classList.contains("active");
|
||||
// Hitung tinggi form yang sedang aktif (termasuk jika ada error box)
|
||||
const formHeight = isActive ? registerForm.offsetHeight : loginForm.offsetHeight;
|
||||
|
||||
// Terapkan tinggi ke card
|
||||
card.style.height = formHeight + "px";
|
||||
}
|
||||
|
||||
// 2. FUNGSI PINDAH LOGIN <-> REGISTER
|
||||
function toggleAuth(mode) {
|
||||
// Reset Error Box saat pindah
|
||||
document.getElementById("loginError").style.display = "none";
|
||||
document.getElementById("regError").style.display = "none";
|
||||
|
||||
if (mode === 'register') {
|
||||
card.classList.add("active");
|
||||
} else {
|
||||
card.classList.remove("active");
|
||||
}
|
||||
|
||||
// Tunggu animasi slide sebentar, baru resize
|
||||
setTimeout(setHeight, 50);
|
||||
}
|
||||
|
||||
// 3. DETEKSI ERROR DARI PHP
|
||||
window.addEventListener("DOMContentLoaded", function() {
|
||||
setHeight(); // Set tinggi awal
|
||||
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
const errorStatus = urlParams.get('error');
|
||||
|
||||
if (errorStatus === 'gagal') {
|
||||
const errorBox = document.getElementById("loginError");
|
||||
errorBox.innerText = "Username atau Password salah!";
|
||||
errorBox.style.display = "block";
|
||||
|
||||
setHeight();
|
||||
window.history.replaceState(null, null, window.location.pathname);
|
||||
}
|
||||
});
|
||||
|
||||
window.addEventListener("resize", setHeight);
|
||||
|
||||
// 4. EFEK GLITTER (HIASAN)
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
for (let i = 0; i < 15; i++) {
|
||||
const g = document.createElement("div");
|
||||
g.className = "glitter";
|
||||
g.style.setProperty("--x", (Math.random() * 200 - 100) + "px");
|
||||
g.style.setProperty("--y", (Math.random() * 200 - 100) + "px");
|
||||
g.style.left = (Math.random() * 100) + "%";
|
||||
g.style.top = (Math.random() * 100) + "%";
|
||||
g.style.animationDelay = (Math.random() * 2) + "s";
|
||||
card.appendChild(g);
|
||||
}
|
||||
});
|
||||
|
||||
// ==========================================
|
||||
// 5. VALIDASI REGISTER (YANG BARU DITAMBAHKAN)
|
||||
// ==========================================
|
||||
if (registerForm) {
|
||||
registerForm.addEventListener("submit", function(event) {
|
||||
// Tahan pengiriman form ke PHP dulu
|
||||
event.preventDefault();
|
||||
|
||||
// Ambil nilai dari inputan (Pastikan ID di HTML sudah sesuai ya!)
|
||||
const username = document.getElementById("regUser").value;
|
||||
const email = document.getElementById("regEmail").value;
|
||||
const password = document.getElementById("regPass").value;
|
||||
const confirmPassword = document.getElementById("regConfirm").value;
|
||||
|
||||
// Fungsi helper untuk menampilkan error di kotak merah Register
|
||||
function showError(pesan) {
|
||||
const errorBox = document.getElementById("regError");
|
||||
errorBox.innerText = pesan;
|
||||
errorBox.style.display = "block";
|
||||
setHeight(); // PENTING: Resize kartu agar pesan error muat
|
||||
}
|
||||
|
||||
// --- Mulai Cek Validasi ---
|
||||
|
||||
// 1. Cek Kosong
|
||||
if (!username || !email || !password || !confirmPassword) {
|
||||
showError("Semua field harus diisi!");
|
||||
return;
|
||||
}
|
||||
|
||||
// 2. Cek Format Email
|
||||
if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)) {
|
||||
showError("Format email tidak valid");
|
||||
return;
|
||||
}
|
||||
|
||||
// 3. Cek Panjang Password
|
||||
if (password.length < 6) {
|
||||
showError("Password minimal 6 karakter");
|
||||
return;
|
||||
}
|
||||
|
||||
// 4. Cek Kesamaan Password
|
||||
if (password !== confirmPassword) {
|
||||
showError("Password dan konfirmasi password tidak cocok");
|
||||
return;
|
||||
}
|
||||
|
||||
// Jika semua aman, baru kirim ke auth.php
|
||||
this.submit();
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
256
login.css
256
login.css
@ -1,256 +0,0 @@
|
||||
body {
|
||||
margin: 0;
|
||||
font-family: Arial, sans-serif;
|
||||
background: linear-gradient(135deg, #d9a7ff, #fbc2eb, #a1c4fd);
|
||||
min-height: 100vh;
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.container, .login-card {
|
||||
background: rgba(255,255,255,0.7);
|
||||
backdrop-filter: blur(10px);
|
||||
padding: 40px;
|
||||
border-radius: 25px;
|
||||
width: 350px;
|
||||
z-index: 10;
|
||||
box-shadow: 0 10px 28px rgba(0,0,0,0.2);
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.icon-wrapper {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
margin-bottom: 20px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.icon-bg {
|
||||
width: 90px; height: 90px;
|
||||
background: linear-gradient(45deg, purple, hotpink);
|
||||
border-radius: 50%;
|
||||
filter: blur(12px);
|
||||
position: absolute;
|
||||
animation: glow 3s infinite alternate;
|
||||
}
|
||||
|
||||
.icon {
|
||||
width: 70px; height: 70px;
|
||||
border-radius: 50%;
|
||||
background: linear-gradient(45deg, purple, hotpink);
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.title {
|
||||
text-align: center;
|
||||
font-size: 22px;
|
||||
margin-bottom: 10px;
|
||||
background: linear-gradient(45deg, purple, hotpink);
|
||||
-webkit-background-clip: text;
|
||||
background-clip: text;
|
||||
color: transparent;
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
text-align: center;
|
||||
color: gray;
|
||||
margin-bottom: 20px;
|
||||
animation:appear 3s ease-out;
|
||||
}
|
||||
|
||||
label {
|
||||
font-size: 14px;
|
||||
color: #444;
|
||||
}
|
||||
|
||||
input {
|
||||
width: 100%;
|
||||
padding: 12px;
|
||||
border-radius: 12px;
|
||||
border: 2px solid #ccc;
|
||||
background: #fafafa;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
|
||||
input:focus {
|
||||
outline: none;
|
||||
border-color: purple;
|
||||
}
|
||||
|
||||
#errorBox {
|
||||
color: red;
|
||||
background: #ffe5e5;
|
||||
padding: 10px;
|
||||
border-radius: 10px;
|
||||
margin-bottom: 10px;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.btn {
|
||||
width: 100%;
|
||||
padding: 14px;
|
||||
background: linear-gradient(45deg, purple, hotpink);
|
||||
color: white;
|
||||
border-radius: 15px;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
font-size: 16px;
|
||||
transition: 0.2s;
|
||||
}
|
||||
|
||||
.btn:hover {
|
||||
transform: scale(1.02);
|
||||
box-shadow: 0 4px 15px rgba(0,0,0,0.3);
|
||||
}
|
||||
|
||||
.btn-login {
|
||||
width: 100%;
|
||||
padding: 14px;
|
||||
background: linear-gradient(45deg, purple, hotpink);
|
||||
color: white;
|
||||
border-radius: 15px;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
font-size: 16px;
|
||||
transition: 0.25s ease;
|
||||
}
|
||||
|
||||
.btn-login:hover {
|
||||
transform: scale(1.03);
|
||||
box-shadow: 0 4px 15px rgba(0,0,0,0.25);
|
||||
}
|
||||
|
||||
.login-container {
|
||||
max-height: none;
|
||||
height: auto;
|
||||
overflow: visible; /* Penting */
|
||||
padding-bottom: 40px; /* Biar bagian bawah tidak kepotong */
|
||||
}
|
||||
|
||||
.login-link {
|
||||
text-align: center;
|
||||
margin-top: 15px;
|
||||
}
|
||||
|
||||
.login-link a {
|
||||
color: purple;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.glitter {
|
||||
position: absolute;
|
||||
width: 4px;
|
||||
height: 4px;
|
||||
background: purple;
|
||||
border-radius: 50%;
|
||||
opacity: 0;
|
||||
animation: glitter-burst 2s infinite ease-out;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
/* Tombol Toggle Demo */
|
||||
.demo-toggle {
|
||||
margin-top: 10px;
|
||||
width: 100%;
|
||||
padding: 10px;
|
||||
border: none;
|
||||
border-radius: 12px;
|
||||
background: rgba(255,255,255,0.6);
|
||||
cursor: pointer;
|
||||
font-size: 15px;
|
||||
transition: 0.3s;
|
||||
}
|
||||
|
||||
.demo-section {
|
||||
margin-top: 20px;
|
||||
padding-bottom: 20px;
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
.demo-toggle:hover {
|
||||
background: rgba(255,255,255,0.85);
|
||||
}
|
||||
|
||||
.demo-box {
|
||||
overflow: hidden;
|
||||
max-height: 0;
|
||||
opacity: 0;
|
||||
transition: max-height 0.5s ease, opacity 0.4s ease;
|
||||
background: rgba(255, 255, 255, 0.6);
|
||||
padding: 15px;
|
||||
border-radius: 12px;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.demo-box.show {
|
||||
max-height: 1000px;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.hidden {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@keyframes glitter-burst {
|
||||
0% {
|
||||
transform: scale(0.4) translate(0,0);
|
||||
opacity: 0.9;
|
||||
}
|
||||
50% {
|
||||
opacity: 1;
|
||||
}
|
||||
100% {
|
||||
transform: scale(1) translate(var(--x), var(--y));
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
@keyframes glow {
|
||||
0% { opacity: 0.2; }
|
||||
100% { opacity: 0.55; }
|
||||
}
|
||||
|
||||
.fruit {
|
||||
position: absolute;
|
||||
width: 95px;
|
||||
opacity: .85;
|
||||
animation: float 6s infinite ease-in-out, drift 15s infinite linear;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.f1 { top: 8%; left: 10%; animation-delay: .3s; }
|
||||
.f2 { top: 65%; right: 12%; animation-delay: .7s; }
|
||||
.f3 { top: 22%; right: 55%; animation-delay: 1.1s; }
|
||||
.f4 { bottom: 15%; left: 28%; animation-delay: .9s; }
|
||||
.f5 { bottom: 10%; right: 30%; animation-delay: 1.4s; }
|
||||
.f6 { top: 40%; left: 50%; animation-delay: .5s; }
|
||||
.f7 { bottom: 30%; left: 15%; animation-delay: 1.2s; }
|
||||
.f8 { top: 75%; right: 40%; animation-delay: .8s; }
|
||||
.f9 { top: 50%; left: 80%; animation-delay: 1s; }
|
||||
.f10 { bottom: 20%; right: 5%; animation-delay: 1.3s; }
|
||||
|
||||
@keyframes float {
|
||||
0% { transform: translateY(0) rotate(0deg); }
|
||||
50% { transform: translateY(-20px) rotate(6deg); }
|
||||
100% { transform: translateY(0) rotate(0deg); }
|
||||
}
|
||||
|
||||
@keyframes drift {
|
||||
0% { transform: translateX(0); }
|
||||
50% { transform: translateX(15px); }
|
||||
100% { transform: translateX(0); }
|
||||
}
|
||||
|
||||
.login-card, .container {
|
||||
transition: transform .4s ease;
|
||||
}
|
||||
.login-card:hover, .container:hover {
|
||||
transform: scale(1.012);
|
||||
}
|
||||
364
login.html
364
login.html
@ -1,14 +1,270 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="id">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Login</title>
|
||||
<link rel="stylesheet" href="login.css" />
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Login</title>
|
||||
|
||||
<style>
|
||||
body {
|
||||
margin: 0;
|
||||
font-family: Arial, sans-serif;
|
||||
background: linear-gradient(135deg, #d9a7ff, #fbc2eb, #a1c4fd);
|
||||
min-height: 100vh;
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.container, .login-card {
|
||||
background: rgba(255,255,255,0.7);
|
||||
backdrop-filter: blur(10px);
|
||||
padding: 40px;
|
||||
border-radius: 25px;
|
||||
width: 350px;
|
||||
z-index: 10;
|
||||
box-shadow: 0 10px 28px rgba(0,0,0,0.2);
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.icon-wrapper {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
margin-bottom: 20px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.icon-bg {
|
||||
width: 90px; height: 90px;
|
||||
background: linear-gradient(45deg, purple, hotpink);
|
||||
border-radius: 50%;
|
||||
filter: blur(12px);
|
||||
position: absolute;
|
||||
animation: glow 3s infinite alternate;
|
||||
}
|
||||
|
||||
.icon {
|
||||
width: 70px; height: 70px;
|
||||
border-radius: 50%;
|
||||
background: linear-gradient(45deg, purple, hotpink);
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.title {
|
||||
text-align: center;
|
||||
font-size: 22px;
|
||||
margin-bottom: 10px;
|
||||
background: linear-gradient(45deg, purple, hotpink);
|
||||
-webkit-background-clip: text;
|
||||
background-clip: text;
|
||||
color: transparent;
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
text-align: center;
|
||||
color: gray;
|
||||
margin-bottom: 20px;
|
||||
animation:appear 3s ease-out;
|
||||
}
|
||||
|
||||
label {
|
||||
font-size: 14px;
|
||||
color: #444;
|
||||
}
|
||||
|
||||
input {
|
||||
width: 100%;
|
||||
padding: 12px;
|
||||
border-radius: 12px;
|
||||
border: 2px solid #ccc;
|
||||
background: #fafafa;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
|
||||
input:focus {
|
||||
outline: none;
|
||||
border-color: purple;
|
||||
}
|
||||
|
||||
#errorBox {
|
||||
color: red;
|
||||
background: #ffe5e5;
|
||||
padding: 10px;
|
||||
border-radius: 10px;
|
||||
margin-bottom: 10px;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.btn {
|
||||
width: 100%;
|
||||
padding: 14px;
|
||||
background: linear-gradient(45deg, purple, hotpink);
|
||||
color: white;
|
||||
border-radius: 15px;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
font-size: 16px;
|
||||
transition: 0.2s;
|
||||
}
|
||||
|
||||
.btn:hover {
|
||||
transform: scale(1.02);
|
||||
box-shadow: 0 4px 15px rgba(0,0,0,0.3);
|
||||
}
|
||||
|
||||
.btn-login {
|
||||
width: 100%;
|
||||
padding: 14px;
|
||||
background: linear-gradient(45deg, purple, hotpink);
|
||||
color: white;
|
||||
border-radius: 15px;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
font-size: 16px;
|
||||
transition: 0.25s ease;
|
||||
}
|
||||
|
||||
.btn-login:hover {
|
||||
transform: scale(1.03);
|
||||
box-shadow: 0 4px 15px rgba(0,0,0,0.25);
|
||||
}
|
||||
|
||||
.login-container {
|
||||
max-height: none;
|
||||
height: auto;
|
||||
overflow: visible;
|
||||
padding-bottom: 40px;
|
||||
}
|
||||
|
||||
.login-link {
|
||||
text-align: center;
|
||||
margin-top: 15px;
|
||||
}
|
||||
|
||||
.login-link a {
|
||||
color: purple;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.glitter {
|
||||
position: absolute;
|
||||
width: 4px;
|
||||
height: 4px;
|
||||
background: purple;
|
||||
border-radius: 50%;
|
||||
opacity: 0;
|
||||
animation: glitter-burst 2s infinite ease-out;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.demo-toggle {
|
||||
margin-top: 10px;
|
||||
width: 100%;
|
||||
padding: 10px;
|
||||
border: none;
|
||||
border-radius: 12px;
|
||||
background: rgba(255,255,255,0.6);
|
||||
cursor: pointer;
|
||||
font-size: 15px;
|
||||
transition: 0.3s;
|
||||
}
|
||||
|
||||
.demo-section {
|
||||
margin-top: 20px;
|
||||
padding-bottom: 20px;
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
.demo-toggle:hover {
|
||||
background: rgba(255,255,255,0.85);
|
||||
}
|
||||
|
||||
.demo-box {
|
||||
overflow: hidden;
|
||||
max-height: 0;
|
||||
opacity: 0;
|
||||
transition: max-height 0.5s ease, opacity 0.4s ease;
|
||||
background: rgba(255, 255, 255, 0.6);
|
||||
padding: 15px;
|
||||
border-radius: 12px;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.demo-box.show {
|
||||
max-height: 1000px;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.hidden {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
@keyframes glitter-burst {
|
||||
0% {
|
||||
transform: scale(0.4) translate(0,0);
|
||||
opacity: 0.9;
|
||||
}
|
||||
50% {
|
||||
opacity: 1;
|
||||
}
|
||||
100% {
|
||||
transform: scale(1) translate(var(--x), var(--y));
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
@keyframes glow {
|
||||
0% { opacity: 0.2; }
|
||||
100% { opacity: 0.55; }
|
||||
}
|
||||
|
||||
.fruit {
|
||||
position: absolute;
|
||||
width: 95px;
|
||||
opacity: .85;
|
||||
animation: float 6s infinite ease-in-out, drift 15s infinite linear;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.f1 { top: 8%; left: 10%; animation-delay: .3s; }
|
||||
.f2 { top: 65%; right: 12%; animation-delay: .7s; }
|
||||
.f3 { top: 22%; right: 55%; animation-delay: 1.1s; }
|
||||
.f4 { bottom: 15%; left: 28%; animation-delay: .9s; }
|
||||
.f5 { bottom: 10%; right: 30%; animation-delay: 1.4s; }
|
||||
.f6 { top: 40%; left: 50%; animation-delay: .5s; }
|
||||
.f7 { bottom: 30%; left: 15%; animation-delay: 1.2s; }
|
||||
.f8 { top: 75%; right: 40%; animation-delay: .8s; }
|
||||
.f9 { top: 50%; left: 80%; animation-delay: 1s; }
|
||||
.f10 { bottom: 20%; right: 5%; animation-delay: 1.3s; }
|
||||
|
||||
@keyframes float {
|
||||
0% { transform: translateY(0) rotate(0deg); }
|
||||
50% { transform: translateY(-20px) rotate(6deg); }
|
||||
100% { transform: translateY(0) rotate(0deg); }
|
||||
}
|
||||
|
||||
@keyframes drift {
|
||||
0% { transform: translateX(0); }
|
||||
50% { transform: translateX(15px); }
|
||||
100% { transform: translateX(0); }
|
||||
}
|
||||
|
||||
.login-card, .container {
|
||||
transition: transform .4s ease;
|
||||
}
|
||||
.login-card:hover, .container:hover {
|
||||
transform: scale(1.012);
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
<!-- Animated Background -->
|
||||
<div class="bg-animated">
|
||||
<div class="bg-circle one"></div>
|
||||
@ -38,16 +294,16 @@
|
||||
<p>Login untuk bermain Memory Flip Card Game</p>
|
||||
</div>
|
||||
|
||||
<form id="loginForm">
|
||||
<form id="loginForm" action="login.php" method="POST">
|
||||
<label>Username</label>
|
||||
<input type="text" id="username" placeholder="Masukkan username">
|
||||
<input type="text" name="username" required id="username" placeholder="Masukan Username">
|
||||
|
||||
<label>Password</label>
|
||||
<input type="password" id="password" placeholder="Masukkan password">
|
||||
<input type="password" name="password" required id="password" placeholder="Masukan Password">
|
||||
|
||||
<div id="errorBox" class="error"></div>
|
||||
|
||||
<button class="btn-login">Login Sekarang</button>
|
||||
<button type="submit" class="btn-login" name="btn-login">Login Sekarang</button>
|
||||
</form>
|
||||
|
||||
<p class="register-text">
|
||||
@ -55,6 +311,94 @@
|
||||
<a href="register.html">Daftar Sekarang</a>
|
||||
</p>
|
||||
|
||||
<script src="login.js"></script>
|
||||
<script>
|
||||
/* LOGIN VALIDATION */
|
||||
document.getElementById("loginForm").addEventListener("submit", function(e) {
|
||||
e.preventDefault(); // jangan reload halaman
|
||||
|
||||
const username = document.getElementById("username").value.trim();
|
||||
const password = document.getElementById("password").value.trim();
|
||||
const errorBox = document.getElementById("errorBox");
|
||||
|
||||
errorBox.style.display = "none";
|
||||
errorBox.innerText = "";
|
||||
|
||||
// Validasi form ringan
|
||||
if (!username || !password) {
|
||||
showError("Username dan password harus diisi");
|
||||
return;
|
||||
}
|
||||
|
||||
if (password.length < 6) {
|
||||
showError("Password minimal 6 karakter");
|
||||
return;
|
||||
}
|
||||
|
||||
// Ambil data user dari localStorage
|
||||
const usersData = localStorage.getItem("users");
|
||||
const users = usersData ? JSON.parse(usersData) : [];
|
||||
|
||||
// Cari user berdasarkan username
|
||||
const user = users.find(u => u.username === username);
|
||||
|
||||
// Jika user tidak ada atau password salah
|
||||
if (!user || user.password !== password) {
|
||||
showError("Username atau password salah");
|
||||
return;
|
||||
}
|
||||
|
||||
// Login sukses
|
||||
localStorage.setItem("loggedInUser", JSON.stringify(user));
|
||||
window.location.href = "mainboard.html";
|
||||
});
|
||||
|
||||
function showError(msg) {
|
||||
const errorBox = document.getElementById("errorBox");
|
||||
errorBox.innerText = msg;
|
||||
errorBox.style.display = "block";
|
||||
}
|
||||
|
||||
/* Toggle Demo */
|
||||
function toggleDemo() {
|
||||
const box = document.getElementById("demoBox");
|
||||
const btn = document.querySelector(".demo-toggle");
|
||||
|
||||
box.classList.toggle("show");
|
||||
|
||||
if (box.classList.contains("show")) {
|
||||
btn.textContent = "Sembunyikan Demo Akun ▲";
|
||||
} else {
|
||||
btn.textContent = "Lihat Demo Akun ▼";
|
||||
}
|
||||
}
|
||||
|
||||
/* GLITTER EFFECT */
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
const card = document.querySelector(".login-card");
|
||||
if (!card) return;
|
||||
|
||||
for (let i = 0; i < 20; i++) {
|
||||
const g = document.createElement("div");
|
||||
g.className = "glitter";
|
||||
g.style.setProperty("--x", (Math.random() * 200 - 100) + "px");
|
||||
g.style.setProperty("--y", (Math.random() * 200 - 100) + "px");
|
||||
g.style.left = (Math.random() * 100) + "%";
|
||||
g.style.top = (Math.random() * 100) + "%";
|
||||
g.style.animationDelay = (Math.random() * 2) + "s";
|
||||
card.appendChild(g);
|
||||
}
|
||||
});
|
||||
|
||||
setInterval(() => {
|
||||
document.querySelectorAll(".glitter").forEach(g => {
|
||||
g.style.setProperty("--x", (Math.random() * 200 - 100) + "px");
|
||||
g.style.setProperty("--y", (Math.random() * 200 - 100) + "px");
|
||||
g.style.left = Math.random() * window.innerWidth + "px";
|
||||
g.style.top = Math.random() * window.innerHeight + "px";
|
||||
});
|
||||
}, 900);
|
||||
</script>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
95
login.js
95
login.js
@ -1,95 +0,0 @@
|
||||
/*LOGIN VALIDATION*/
|
||||
document.getElementById("loginForm").addEventListener("submit", function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
const username = document.getElementById("username").value.trim();
|
||||
const password = document.getElementById("password").value.trim();
|
||||
const errorBox = document.getElementById("errorBox");
|
||||
|
||||
errorBox.style.display = "none";
|
||||
errorBox.innerText = "";
|
||||
|
||||
if (!username || !password) {
|
||||
showError("Username dan password harus diisi");
|
||||
return;
|
||||
}
|
||||
|
||||
if (password.length < 6) {
|
||||
showError("Password minimal 6 karakter");
|
||||
return;
|
||||
}
|
||||
|
||||
const usersData = localStorage.getItem("users");
|
||||
const users = usersData ? JSON.parse(usersData) : [];
|
||||
|
||||
const user = users.find(u => u.username === username);
|
||||
|
||||
if (!user) {
|
||||
showError("Username tidak ditemukan");
|
||||
return;
|
||||
}
|
||||
|
||||
if (user.password !== password) {
|
||||
showError("Password salah");
|
||||
return;
|
||||
}
|
||||
|
||||
// Login sukses
|
||||
localStorage.setItem("loggedInUser", JSON.stringify(user));
|
||||
window.location.href = "mainboard.html";
|
||||
});
|
||||
|
||||
function showError(msg) {
|
||||
const errorBox = document.getElementById("errorBox");
|
||||
errorBox.innerText = msg;
|
||||
errorBox.style.display = "block";
|
||||
}
|
||||
|
||||
function toggleDemo() {
|
||||
const box = document.getElementById("demoBox");
|
||||
const btn = document.querySelector(".demo-toggle");
|
||||
|
||||
box.classList.toggle("show");
|
||||
|
||||
// Ubah teks tombol
|
||||
if (box.classList.contains("show")) {
|
||||
btn.textContent = "Sembunyikan Demo Akun ▲";
|
||||
} else {
|
||||
btn.textContent = "Lihat Demo Akun ▼";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* GLITTER EFFECT*/
|
||||
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
const card = document.querySelector(".login-card");
|
||||
|
||||
if (!card) return;
|
||||
|
||||
// Tambah glitter 20x
|
||||
for (let i = 0; i < 20; i++) {
|
||||
const g = document.createElement("div");
|
||||
g.className = "glitter";
|
||||
|
||||
// Random posisi ledakan glitter
|
||||
g.style.setProperty("--x", (Math.random() * 200 - 100) + "px");
|
||||
g.style.setProperty("--y", (Math.random() * 200 - 100) + "px");
|
||||
|
||||
g.style.left = (Math.random() * 100) + "%";
|
||||
g.style.top = (Math.random() * 100) + "%";
|
||||
|
||||
g.style.animationDelay = (Math.random() * 2) + "s";
|
||||
|
||||
card.appendChild(g);
|
||||
}
|
||||
});
|
||||
|
||||
setInterval(() => {
|
||||
document.querySelectorAll(".glitter").forEach(g => {
|
||||
g.style.setProperty("--x", (Math.random() * 200 - 100) + "px");
|
||||
g.style.setProperty("--y", (Math.random() * 200 - 100) + "px");
|
||||
g.style.left = Math.random() * window.innerWidth + "px";
|
||||
g.style.top = Math.random() * window.innerHeight + "px";
|
||||
});
|
||||
}, 900);
|
||||
67
login.php
67
login.php
@ -1,45 +1,40 @@
|
||||
<?php
|
||||
// Simpan dengan nama file: login.php
|
||||
session_start();
|
||||
require_once "Config.php";
|
||||
|
||||
//untuk halaman login
|
||||
include "koneksi.php";
|
||||
if (isset($_POST['username']))
|
||||
{
|
||||
$username=$_POST['username'];
|
||||
}
|
||||
else $username ='';
|
||||
if (isset($_POST['password']))
|
||||
{
|
||||
$password=$_POST['password'];
|
||||
}
|
||||
else $password ='';
|
||||
if ($username!='' || $password!='')
|
||||
{
|
||||
$stmt = mysqli_prepare($conn,"select * from user where username=? and password=?");
|
||||
$enc=md5($password);
|
||||
mysqli_stmt_bind_param($stmt,"ss", $username,$enc);
|
||||
if(isset($_POST['btn-login'])){
|
||||
$username = $_POST['username'];
|
||||
$password = $_POST['password'];
|
||||
|
||||
// PERBAIKAN 1: Nama tabel disamakan jadi 'users' (pakai s)
|
||||
$stmt = mysqli_prepare($conn, "SELECT * FROM users WHERE username=?");
|
||||
mysqli_stmt_bind_param($stmt, "s", $username);
|
||||
mysqli_stmt_execute($stmt);
|
||||
|
||||
$result = mysqli_stmt_get_result($stmt);
|
||||
if ($row=mysqli_fetch_assoc($result))
|
||||
{
|
||||
echo "Login sukses";
|
||||
$_session['firstname'] = $row['firstname']; //simpan session firstname
|
||||
$_session['lastname'] = $row['lastname'];
|
||||
header("Location:dashboard.php"); //untuk pindah ke halaman dashboard.php
|
||||
$row = mysqli_fetch_assoc($result);
|
||||
|
||||
echo "firstname:".$row['firstname']."<br>";//kalo di file yang sama
|
||||
echo "lastname:".$row['lastname']."<br>";
|
||||
// Kalau username tidak ditemukan ATAU password salah
|
||||
if (!$row || !password_verify($password, $row['password'])) {
|
||||
// PERBAIKAN 2: Pakai Script Alert biar user dikembalikan ke index
|
||||
echo "<script>
|
||||
alert('Username atau Password salah!');
|
||||
window.location.href='index.html';
|
||||
</script>";
|
||||
exit;
|
||||
}
|
||||
else echo "Username/password salah";
|
||||
|
||||
// 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 "<script>
|
||||
alert('Login Berhasil! Selamat Datang, " . $username . "');
|
||||
window.location.href='mainboard.html';
|
||||
</script>";
|
||||
exit;
|
||||
}
|
||||
?>
|
||||
|
||||
<html>
|
||||
<body>
|
||||
<form method="POST">
|
||||
Username: <input type="text" name="username"><br>
|
||||
Password:<input type="password" name="password"><br>
|
||||
<input type="submit">
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
205
mainboard.css
205
mainboard.css
@ -1,205 +0,0 @@
|
||||
/* ================================
|
||||
BODY & BACKGROUND STYLES
|
||||
================================== */
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
font-family: Poppins, Arial, sans-serif;
|
||||
background: linear-gradient(135deg, #d9a7ff, #fbc2eb, #a1c4fd);
|
||||
min-height: 100vh;
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
padding: 50px 0;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
|
||||
/* Glow Background Floating */
|
||||
.bg-circle {
|
||||
position: absolute;
|
||||
border-radius: 50%;
|
||||
filter: blur(70px);
|
||||
opacity: 0.7;
|
||||
animation: float 6s infinite ease-in-out;
|
||||
}
|
||||
|
||||
.circle-one { top: 10%; left: 5%; width: 250px; height: 250px; background: rgba(255,255,255,0.25); }
|
||||
.circle-two { bottom: 15%; right: 8%; width: 300px; height: 300px; background: rgba(255,192,203,0.35); animation-delay: 1s; }
|
||||
.circle-three { top: 45%; left: 60%; width: 260px; height: 260px; background: rgba(180,120,255,0.35); animation-delay: 2s; }
|
||||
|
||||
@keyframes float {
|
||||
0%,100% { transform: translateY(0); }
|
||||
50% { transform: translateY(-25px); }
|
||||
}
|
||||
|
||||
/* ================================
|
||||
CONTAINER CARD
|
||||
================================== */
|
||||
|
||||
.container {
|
||||
width: 750px;
|
||||
background: rgba(255,255,255,0.7);
|
||||
backdrop-filter: blur(15px);
|
||||
padding: 45px;
|
||||
border-radius: 28px;
|
||||
box-shadow: 0 15px 35px rgba(0,0,0,0.2);
|
||||
z-index: 10;
|
||||
animation: fadeIn 0.6s ease-out;
|
||||
}
|
||||
|
||||
@keyframes fadeIn {
|
||||
from { opacity: 0; transform: translateY(20px); }
|
||||
to { opacity: 1; transform: translateY(0); }
|
||||
}
|
||||
|
||||
/* ================================
|
||||
HEADER PROFILE
|
||||
================================== */
|
||||
|
||||
.header {
|
||||
background: rgba(255,255,255,0.65);
|
||||
backdrop-filter: blur(15px);
|
||||
padding: 22px;
|
||||
border-radius: 20px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
box-shadow: 0 10px 30px rgba(0,0,0,0.08);
|
||||
margin-bottom: 35px;
|
||||
}
|
||||
|
||||
.user-info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 15px;
|
||||
}
|
||||
|
||||
.user-icon {
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
border-radius: 50%;
|
||||
background: linear-gradient(135deg, purple, hotpink);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: white;
|
||||
font-size: 25px;
|
||||
font-weight: bold;
|
||||
box-shadow: 0 5px 18px rgba(0,0,0,0.22);
|
||||
}
|
||||
|
||||
/* ================================
|
||||
🎀 BUTTONS
|
||||
================================== */
|
||||
|
||||
.btn {
|
||||
padding: 12px 25px;
|
||||
border: none;
|
||||
border-radius: 14px;
|
||||
cursor: pointer;
|
||||
font-size: 16px;
|
||||
transition: .25s;
|
||||
}
|
||||
|
||||
.gold {
|
||||
background: linear-gradient(to right, gold, orange);
|
||||
color: white;
|
||||
}
|
||||
.gold:hover {
|
||||
transform: scale(1.07);
|
||||
box-shadow: 0 4px 12px rgba(255,165,0,0.4);
|
||||
}
|
||||
|
||||
.gray {
|
||||
background: #444;
|
||||
color: white;
|
||||
}
|
||||
.gray:hover {
|
||||
background: #222;
|
||||
transform: scale(1.05);
|
||||
}
|
||||
|
||||
/* ================================
|
||||
📝 TITLE
|
||||
================================== */
|
||||
|
||||
.title {
|
||||
text-align: center;
|
||||
margin: 40px 0;
|
||||
}
|
||||
|
||||
.title h1 {
|
||||
font-size: 46px;
|
||||
background: linear-gradient(purple, hotpink);
|
||||
background-clip: text; /* Standar */
|
||||
-webkit-background-clip: text;
|
||||
color: transparent;
|
||||
font-weight: bold;
|
||||
text-shadow: 0 0 10px rgba(255,255,255,0.2);
|
||||
}
|
||||
|
||||
/* ================================
|
||||
🎮 STAGE SELECTION GRID
|
||||
================================== */
|
||||
|
||||
.stage-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
gap: 30px;
|
||||
}
|
||||
|
||||
.stage-btn {
|
||||
background: rgba(255,255,255,0.65);
|
||||
backdrop-filter: blur(10px);
|
||||
padding: 35px;
|
||||
border-radius: 25px;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
transition: .25s ease;
|
||||
box-shadow: 0 12px 25px rgba(0,0,0,0.12);
|
||||
}
|
||||
|
||||
.stage-btn:hover {
|
||||
transform: scale(1.08);
|
||||
background: rgba(255,255,255,0.88);
|
||||
box-shadow: 0 10px 20px rgba(0,0,0,0.25);
|
||||
}
|
||||
|
||||
.icon {
|
||||
font-size: 48px;
|
||||
display: block;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.fruit {
|
||||
position: absolute;
|
||||
width: 95px;
|
||||
opacity: .85;
|
||||
animation: float 6s infinite ease-in-out, drift 15s infinite linear;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.f1 { top: 8%; left: 10%; animation-delay: .3s; }
|
||||
.f2 { top: 65%; right: 12%; animation-delay: .7s; }
|
||||
.f3 { top: 22%; right: 55%; animation-delay: 1.1s; }
|
||||
.f4 { bottom: 15%; left: 28%; animation-delay: .9s; }
|
||||
.f5 { bottom: 10%; right: 30%; animation-delay: 1.4s; }
|
||||
.f6 { top: 40%; left: 50%; animation-delay: .5s; }
|
||||
.f7 { bottom: 30%; left: 15%; animation-delay: 1.2s; }
|
||||
.f8 { top: 75%; right: 40%; animation-delay: .8s; }
|
||||
.f9 { top: 50%; left: 80%; animation-delay: 1s; }
|
||||
.f10 { bottom: 20%; right: 5%; animation-delay: 1.3s; }
|
||||
|
||||
@keyframes float {
|
||||
0% { transform: translateY(0) rotate(0deg); }
|
||||
50% { transform: translateY(-20px) rotate(6deg); }
|
||||
100% { transform: translateY(0) rotate(0deg); }
|
||||
}
|
||||
|
||||
@keyframes drift {
|
||||
0% { transform: translateX(0); }
|
||||
50% { transform: translateX(15px); }
|
||||
100% { transform: translateX(0); }
|
||||
}
|
||||
232
mainboard.html
232
mainboard.html
@ -4,7 +4,216 @@
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Memory Flip Card Game</title>
|
||||
<link rel="stylesheet" href="mainboard.css">
|
||||
|
||||
<style>
|
||||
/* ================================
|
||||
BODY & BACKGROUND STYLES
|
||||
================================== */
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
font-family: Poppins, Arial, sans-serif;
|
||||
background: linear-gradient(135deg, #d9a7ff, #fbc2eb, #a1c4fd);
|
||||
min-height: 100vh;
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
padding: 50px 0;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
|
||||
/* Glow Background Floating */
|
||||
.bg-circle {
|
||||
position: absolute;
|
||||
border-radius: 50%;
|
||||
filter: blur(70px);
|
||||
opacity: 0.7;
|
||||
animation: float 6s infinite ease-in-out;
|
||||
}
|
||||
|
||||
.circle-one { top: 10%; left: 5%; width: 250px; height: 250px; background: rgba(255,255,255,0.25); }
|
||||
.circle-two { bottom: 15%; right: 8%; width: 300px; height: 300px; background: rgba(255,192,203,0.35); animation-delay: 1s; }
|
||||
.circle-three { top: 45%; left: 60%; width: 260px; height: 260px; background: rgba(180,120,255,0.35); animation-delay: 2s; }
|
||||
|
||||
@keyframes float {
|
||||
0%,100% { transform: translateY(0); }
|
||||
50% { transform: translateY(-25px); }
|
||||
}
|
||||
|
||||
/* ================================
|
||||
CONTAINER CARD
|
||||
================================== */
|
||||
|
||||
.container {
|
||||
width: 750px;
|
||||
background: rgba(255,255,255,0.7);
|
||||
backdrop-filter: blur(15px);
|
||||
padding: 45px;
|
||||
border-radius: 28px;
|
||||
box-shadow: 0 15px 35px rgba(0,0,0,0.2);
|
||||
z-index: 10;
|
||||
animation: fadeIn 0.6s ease-out;
|
||||
}
|
||||
|
||||
@keyframes fadeIn {
|
||||
from { opacity: 0; transform: translateY(20px); }
|
||||
to { opacity: 1; transform: translateY(0); }
|
||||
}
|
||||
|
||||
/* ================================
|
||||
HEADER PROFILE
|
||||
================================== */
|
||||
|
||||
.header {
|
||||
background: rgba(255,255,255,0.65);
|
||||
backdrop-filter: blur(15px);
|
||||
padding: 22px;
|
||||
border-radius: 20px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
box-shadow: 0 10px 30px rgba(0,0,0,0.08);
|
||||
margin-bottom: 35px;
|
||||
}
|
||||
|
||||
.user-info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 15px;
|
||||
}
|
||||
|
||||
.user-icon {
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
border-radius: 50%;
|
||||
background: linear-gradient(135deg, purple, hotpink);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: white;
|
||||
font-size: 25px;
|
||||
font-weight: bold;
|
||||
box-shadow: 0 5px 18px rgba(0,0,0,0.22);
|
||||
}
|
||||
|
||||
/* ================================
|
||||
🎀 BUTTONS
|
||||
================================== */
|
||||
|
||||
.btn {
|
||||
padding: 12px 25px;
|
||||
border: none;
|
||||
border-radius: 14px;
|
||||
cursor: pointer;
|
||||
font-size: 16px;
|
||||
transition: .25s;
|
||||
}
|
||||
|
||||
.gold {
|
||||
background: linear-gradient(to right, gold, orange);
|
||||
color: white;
|
||||
}
|
||||
.gold:hover {
|
||||
transform: scale(1.07);
|
||||
box-shadow: 0 4px 12px rgba(255,165,0,0.4);
|
||||
}
|
||||
|
||||
.gray {
|
||||
background: #444;
|
||||
color: white;
|
||||
}
|
||||
.gray:hover {
|
||||
background: #222;
|
||||
transform: scale(1.05);
|
||||
}
|
||||
|
||||
/* ================================
|
||||
📝 TITLE
|
||||
================================== */
|
||||
|
||||
.title {
|
||||
text-align: center;
|
||||
margin: 40px 0;
|
||||
}
|
||||
|
||||
.title h1 {
|
||||
font-size: 46px;
|
||||
background: linear-gradient(purple, hotpink);
|
||||
background-clip: text; /* Standar */
|
||||
-webkit-background-clip: text;
|
||||
color: transparent;
|
||||
font-weight: bold;
|
||||
text-shadow: 0 0 10px rgba(255,255,255,0.2);
|
||||
}
|
||||
|
||||
/* ================================
|
||||
🎮 STAGE SELECTION GRID
|
||||
================================== */
|
||||
|
||||
.stage-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
gap: 30px;
|
||||
}
|
||||
|
||||
.stage-btn {
|
||||
background: rgba(255,255,255,0.65);
|
||||
backdrop-filter: blur(10px);
|
||||
padding: 35px;
|
||||
border-radius: 25px;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
transition: .25s ease;
|
||||
box-shadow: 0 12px 25px rgba(0,0,0,0.12);
|
||||
}
|
||||
|
||||
.stage-btn:hover {
|
||||
transform: scale(1.08);
|
||||
background: rgba(255,255,255,0.88);
|
||||
box-shadow: 0 10px 20px rgba(0,0,0,0.25);
|
||||
}
|
||||
|
||||
.icon {
|
||||
font-size: 48px;
|
||||
display: block;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.fruit {
|
||||
position: absolute;
|
||||
width: 95px;
|
||||
opacity: .85;
|
||||
animation: float 6s infinite ease-in-out, drift 15s infinite linear;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.f1 { top: 8%; left: 10%; animation-delay: .3s; }
|
||||
.f2 { top: 65%; right: 12%; animation-delay: .7s; }
|
||||
.f3 { top: 22%; right: 55%; animation-delay: 1.1s; }
|
||||
.f4 { bottom: 15%; left: 28%; animation-delay: .9s; }
|
||||
.f5 { bottom: 10%; right: 30%; animation-delay: 1.4s; }
|
||||
.f6 { top: 40%; left: 50%; animation-delay: .5s; }
|
||||
.f7 { bottom: 30%; left: 15%; animation-delay: 1.2s; }
|
||||
.f8 { top: 75%; right: 40%; animation-delay: .8s; }
|
||||
.f9 { top: 50%; left: 80%; animation-delay: 1s; }
|
||||
.f10 { bottom: 20%; right: 5%; animation-delay: 1.3s; }
|
||||
|
||||
@keyframes float {
|
||||
0% { transform: translateY(0) rotate(0deg); }
|
||||
50% { transform: translateY(-20px) rotate(6deg); }
|
||||
100% { transform: translateY(0) rotate(0deg); }
|
||||
}
|
||||
|
||||
@keyframes drift {
|
||||
0% { transform: translateX(0); }
|
||||
50% { transform: translateX(15px); }
|
||||
100% { transform: translateX(0); }
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
@ -32,7 +241,7 @@
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
<button id="leaderboardBtn" class="btn gold">🏆 Leaderboard</button>
|
||||
<button id="leaderboardBtn" class="btn gold" onclick="window.location.href='leaderboard.html'">🏆 Leaderboard</button>
|
||||
<button id="logoutBtn" class="btn gray">🚪 Logout</button>
|
||||
</div>
|
||||
</header>
|
||||
@ -65,6 +274,23 @@
|
||||
|
||||
</div>
|
||||
|
||||
<script src="mainboard.js"></script>
|
||||
<script>
|
||||
function selectStage(stage) {
|
||||
if (stage === "easy") {
|
||||
window.location.href = "gameboard-easy.html";
|
||||
} else if (stage === "medium") {
|
||||
window.location.href = "gameboard-medium.html";
|
||||
} else if (stage === "hard") {
|
||||
window.location.href = "gameboard-hard.html";
|
||||
}
|
||||
}
|
||||
|
||||
document.getElementById("leaderboardBtn").addEventListener("click", () => {window.location.href = "Leaderboard.html"});
|
||||
|
||||
document.getElementById("logoutBtn").addEventListener("click", () => {
|
||||
alert("Logout berhasil!");
|
||||
});
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
16
mainboard.js
16
mainboard.js
@ -1,16 +0,0 @@
|
||||
function selectStage(stage) {
|
||||
if (stage === "easy") {
|
||||
window.location.href = "gameboard-easy.html";
|
||||
} else if (stage === "medium") {
|
||||
window.location.href = "gameboard-medium.html";
|
||||
} else if (stage === "hard") {
|
||||
window.location.href = "gameboard-hard.html";
|
||||
}
|
||||
}
|
||||
document.getElementById("leaderboardBtn").addEventListener("click", () => {
|
||||
alert("Menuju Leaderboard");
|
||||
});
|
||||
|
||||
document.getElementById("logoutBtn").addEventListener("click", () => {
|
||||
alert("Logout berhasil!");
|
||||
});
|
||||
200
register.css
200
register.css
@ -1,200 +0,0 @@
|
||||
body {
|
||||
margin: 0;
|
||||
font-family: Arial, sans-serif;
|
||||
background: linear-gradient(135deg, #d9a7ff, #fbc2eb, #a1c4fd);;
|
||||
}
|
||||
|
||||
.page {
|
||||
height: 100vh;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
/* Background Animasi */
|
||||
.bg-1, .bg-2, .bg-3 {
|
||||
position: absolute;
|
||||
border-radius: 50%;
|
||||
filter: blur(70px);
|
||||
opacity: 0.4;
|
||||
}
|
||||
|
||||
.bg-1 {
|
||||
width: 300px; height: 300px;
|
||||
background: rgba(255,255,255,0.3);
|
||||
top: 10%; left: 10%;
|
||||
animation: glow 4s infinite alternate;
|
||||
}
|
||||
|
||||
.bg-2 {
|
||||
width: 400px; height: 400px;
|
||||
background: rgba(255,120,200,0.3);
|
||||
bottom: 10%; right: 10%;
|
||||
animation: float 6s infinite;
|
||||
}
|
||||
|
||||
.bg-3 {
|
||||
width: 250px; height: 250px;
|
||||
background: rgba(200,100,255,0.3);
|
||||
top: 50%; left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
animation: glow 5s infinite alternate;
|
||||
}
|
||||
|
||||
@keyframes glow {
|
||||
0% { opacity: 0.2; }
|
||||
100% { opacity: 0.55; }
|
||||
}
|
||||
|
||||
@keyframes float {
|
||||
0% { transform: translateY(0); }
|
||||
50% { transform: translateY(-20px); }
|
||||
100% { transform: translateY(0); }
|
||||
}
|
||||
|
||||
/* Container */
|
||||
.container {
|
||||
background: rgba(255,255,255,0.7);
|
||||
backdrop-filter: blur(10px);
|
||||
padding: 40px;
|
||||
border-radius: 25px;
|
||||
width: 350px;
|
||||
z-index: 10;
|
||||
box-shadow: 0 10px 28px rgba(0,0,0,0.2);
|
||||
}
|
||||
|
||||
/* Icon */
|
||||
.icon-wrapper {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.icon-bg {
|
||||
width: 90px; height: 90px;
|
||||
background: linear-gradient(45deg, purple, hotpink);
|
||||
border-radius: 50%;
|
||||
filter: blur(12px);
|
||||
position: absolute;
|
||||
animation: glow 3s infinite alternate;
|
||||
}
|
||||
|
||||
.icon {
|
||||
background: linear-gradient(45deg, purple, hotpink);
|
||||
border-radius: 50%;
|
||||
width: 70px; height: 70px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
/* Text */
|
||||
.title {
|
||||
text-align: center;
|
||||
font-size: 22px;
|
||||
margin-bottom: 10px;
|
||||
color: white;
|
||||
padding: 10px;
|
||||
border-radius: 40px;
|
||||
background: linear-gradient(45deg, purple, hotpink);;
|
||||
font-family: 'Segoe UI', Tahoma, Verdana, sans-serif;
|
||||
text-shadow:
|
||||
0 0 10px #000000,
|
||||
}
|
||||
|
||||
|
||||
.subtitle {
|
||||
text-align: center;
|
||||
color: gray;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
/* Form */
|
||||
label {
|
||||
font-size: 14px;
|
||||
color: #444;
|
||||
}
|
||||
|
||||
input {
|
||||
width: 100%;
|
||||
padding: 12px;
|
||||
border-radius: 12px;
|
||||
border: 2px solid #ccc;
|
||||
background: #fafafa;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
input:focus {
|
||||
outline: none;
|
||||
border-color: purple;
|
||||
}
|
||||
|
||||
#errorBox {
|
||||
color: red;
|
||||
background: #ffe5e5;
|
||||
padding: 10px;
|
||||
border-radius: 10px;
|
||||
margin-bottom: 10px;
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Button */
|
||||
.btn {
|
||||
width: 100%;
|
||||
background: linear-gradient(45deg, purple, hotpink);
|
||||
color: white;
|
||||
padding: 14px;
|
||||
border: none;
|
||||
border-radius: 15px;
|
||||
font-size: 16px;
|
||||
cursor: pointer;
|
||||
transition: 0.2s;
|
||||
}
|
||||
|
||||
.btn:hover {
|
||||
transform: scale(1.02);
|
||||
box-shadow: 0 4px 15px rgba(0,0,0,0.3);
|
||||
}
|
||||
|
||||
.login-link {
|
||||
text-align: center;
|
||||
margin-top: 15px;
|
||||
}
|
||||
|
||||
.login-link a {
|
||||
color: purple;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.fruit {
|
||||
position: absolute;
|
||||
width: 95px;
|
||||
opacity: .85;
|
||||
animation: float 6s infinite ease-in-out, drift 15s infinite linear;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.f1 { top: 8%; left: 10%; animation-delay: .3s; }
|
||||
.f2 { top: 65%; right: 12%; animation-delay: .7s; }
|
||||
.f3 { top: 22%; right: 55%; animation-delay: 1.1s; }
|
||||
.f4 { bottom: 15%; left: 28%; animation-delay: .9s; }
|
||||
.f5 { bottom: 10%; right: 30%; animation-delay: 1.4s; }
|
||||
.f6 { top: 40%; left: 50%; animation-delay: .5s; }
|
||||
.f7 { bottom: 30%; left: 15%; animation-delay: 1.2s; }
|
||||
.f8 { top: 75%; right: 40%; animation-delay: .8s; }
|
||||
.f9 { top: 50%; left: 80%; animation-delay: 1s; }
|
||||
.f10 { bottom: 20%; right: 5%; animation-delay: 1.3s; }
|
||||
|
||||
@keyframes float {
|
||||
0% { transform: translateY(0) rotate(0deg); }
|
||||
50% { transform: translateY(-20px) rotate(6deg); }
|
||||
100% { transform: translateY(0) rotate(0deg); }
|
||||
}
|
||||
|
||||
@keyframes drift {
|
||||
0% { transform: translateX(0); }
|
||||
50% { transform: translateX(15px); }
|
||||
100% { transform: translateX(0); }
|
||||
}
|
||||
281
register.html
281
register.html
@ -4,7 +4,210 @@
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Register Akun</title>
|
||||
<link rel="stylesheet" href="register.css" />
|
||||
|
||||
<style>
|
||||
body {
|
||||
margin: 0;
|
||||
font-family: Arial, sans-serif;
|
||||
background: linear-gradient(135deg, #d9a7ff, #fbc2eb, #a1c4fd);;
|
||||
}
|
||||
|
||||
.page {
|
||||
height: 100vh;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
/* Background Animasi */
|
||||
.bg-1, .bg-2, .bg-3 {
|
||||
position: absolute;
|
||||
border-radius: 50%;
|
||||
filter: blur(70px);
|
||||
opacity: 0.4;
|
||||
}
|
||||
|
||||
.bg-1 {
|
||||
width: 300px; height: 300px;
|
||||
background: rgba(255,255,255,0.3);
|
||||
top: 10%; left: 10%;
|
||||
animation: glow 4s infinite alternate;
|
||||
}
|
||||
|
||||
.bg-2 {
|
||||
width: 400px; height: 400px;
|
||||
background: rgba(255,120,200,0.3);
|
||||
bottom: 10%; right: 10%;
|
||||
animation: float 6s infinite;
|
||||
}
|
||||
|
||||
.bg-3 {
|
||||
width: 250px; height: 250px;
|
||||
background: rgba(200,100,255,0.3);
|
||||
top: 50%; left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
animation: glow 5s infinite alternate;
|
||||
}
|
||||
|
||||
@keyframes glow {
|
||||
0% { opacity: 0.2; }
|
||||
100% { opacity: 0.55; }
|
||||
}
|
||||
|
||||
@keyframes float {
|
||||
0% { transform: translateY(0); }
|
||||
50% { transform: translateY(-20px); }
|
||||
100% { transform: translateY(0); }
|
||||
}
|
||||
|
||||
/* Container */
|
||||
.container {
|
||||
background: rgba(255,255,255,0.7);
|
||||
backdrop-filter: blur(10px);
|
||||
padding: 40px;
|
||||
border-radius: 25px;
|
||||
width: 350px;
|
||||
z-index: 10;
|
||||
box-shadow: 0 10px 28px rgba(0,0,0,0.2);
|
||||
}
|
||||
|
||||
/* Icon */
|
||||
.icon-wrapper {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.icon-bg {
|
||||
width: 90px; height: 90px;
|
||||
background: linear-gradient(45deg, purple, hotpink);
|
||||
border-radius: 50%;
|
||||
filter: blur(12px);
|
||||
position: absolute;
|
||||
animation: glow 3s infinite alternate;
|
||||
}
|
||||
|
||||
.icon {
|
||||
background: linear-gradient(45deg, purple, hotpink);
|
||||
border-radius: 50%;
|
||||
width: 70px; height: 70px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
/* Text */
|
||||
.title {
|
||||
text-align: center;
|
||||
font-size: 22px;
|
||||
margin-bottom: 10px;
|
||||
color: white;
|
||||
padding: 10px;
|
||||
border-radius: 40px;
|
||||
background: linear-gradient(45deg, purple, hotpink);;
|
||||
font-family: 'Segoe UI', Tahoma, Verdana, sans-serif;
|
||||
text-shadow:
|
||||
0 0 10px #000000,
|
||||
}
|
||||
|
||||
|
||||
.subtitle {
|
||||
text-align: center;
|
||||
color: gray;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
/* Form */
|
||||
label {
|
||||
font-size: 14px;
|
||||
color: #444;
|
||||
}
|
||||
|
||||
input {
|
||||
width: 100%;
|
||||
padding: 12px;
|
||||
border-radius: 12px;
|
||||
border: 2px solid #ccc;
|
||||
background: #fafafa;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
input:focus {
|
||||
outline: none;
|
||||
border-color: purple;
|
||||
}
|
||||
|
||||
#errorBox {
|
||||
color: red;
|
||||
background: #ffe5e5;
|
||||
padding: 10px;
|
||||
border-radius: 10px;
|
||||
margin-bottom: 10px;
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Button */
|
||||
.btn-register {
|
||||
width: 100%;
|
||||
background: linear-gradient(45deg, purple, hotpink);
|
||||
color: white;
|
||||
padding: 14px;
|
||||
border: none;
|
||||
border-radius: 15px;
|
||||
font-size: 16px;
|
||||
cursor: pointer;
|
||||
transition: 0.2s;
|
||||
}
|
||||
|
||||
.btn:hover {
|
||||
transform: scale(1.02);
|
||||
box-shadow: 0 4px 15px rgba(0,0,0,0.3);
|
||||
}
|
||||
|
||||
.login-link {
|
||||
text-align: center;
|
||||
margin-top: 15px;
|
||||
}
|
||||
|
||||
.login-link a {
|
||||
color: purple;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.fruit {
|
||||
position: absolute;
|
||||
width: 95px;
|
||||
opacity: .85;
|
||||
animation: float 6s infinite ease-in-out, drift 15s infinite linear;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.f1 { top: 8%; left: 10%; animation-delay: .3s; }
|
||||
.f2 { top: 65%; right: 12%; animation-delay: .7s; }
|
||||
.f3 { top: 22%; right: 55%; animation-delay: 1.1s; }
|
||||
.f4 { bottom: 15%; left: 28%; animation-delay: .9s; }
|
||||
.f5 { bottom: 10%; right: 30%; animation-delay: 1.4s; }
|
||||
.f6 { top: 40%; left: 50%; animation-delay: .5s; }
|
||||
.f7 { bottom: 30%; left: 15%; animation-delay: 1.2s; }
|
||||
.f8 { top: 75%; right: 40%; animation-delay: .8s; }
|
||||
.f9 { top: 50%; left: 80%; animation-delay: 1s; }
|
||||
.f10 { bottom: 20%; right: 5%; animation-delay: 1.3s; }
|
||||
|
||||
@keyframes float {
|
||||
0% { transform: translateY(0) rotate(0deg); }
|
||||
50% { transform: translateY(-20px) rotate(6deg); }
|
||||
100% { transform: translateY(0) rotate(0deg); }
|
||||
}
|
||||
|
||||
@keyframes drift {
|
||||
0% { transform: translateX(0); }
|
||||
50% { transform: translateX(15px); }
|
||||
100% { transform: translateX(0); }
|
||||
}
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@ -27,22 +230,22 @@
|
||||
<h2 class="title">Buat Akun Baru ✨</h2>
|
||||
<p class="subtitle">Daftar untuk bermain Memory Card Game</p>
|
||||
|
||||
<form id="registerForm">
|
||||
<form id="registerForm" action="register.php" method="POST">
|
||||
<label>Username</label>
|
||||
<input type="text" id="username" placeholder="Pilih username">
|
||||
<input type="text" name="username" required id="username" placeholder="Pilih Username">
|
||||
|
||||
<label>Email</label>
|
||||
<input type="email" id="email" placeholder="email@example.com">
|
||||
<input type="email" name="email" required id="email" placeholder="Masukan Email">
|
||||
|
||||
<label>Password</label>
|
||||
<input type="password" id="password" placeholder="Minimal 6 karakter">
|
||||
<input type="password" name="password" required id="password" placeholder="Minimal 6 karakter">
|
||||
|
||||
<label>Konfirmasi Password</label>
|
||||
<input type="password" id="confirmPassword" placeholder="Ketik ulang password">
|
||||
<input type="password" name="confirm_password" id="confirm_password" required placeholder="Ketik ulang password">
|
||||
|
||||
<div id="errorBox"></div>
|
||||
|
||||
<button type="submit" class="btn">Daftar Sekarang</button>
|
||||
<button type="submit" class="btn-register" name="btn-register">Daftar Sekarang</button>
|
||||
</form>
|
||||
|
||||
<p class="login-link">
|
||||
@ -51,6 +254,68 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="register.js"></script>
|
||||
<script>
|
||||
document.getElementById("registerForm").addEventListener("submit", function(e) {
|
||||
e.preventDefault(); // jangan reload halaman
|
||||
|
||||
const username = document.getElementById("username").value.trim();
|
||||
const email = document.getElementById("email").value.trim();
|
||||
const password = document.getElementById("password").value.trim();
|
||||
const confirmPassword = document.getElementById("confirm_password").value.trim();
|
||||
const errorBox = document.getElementById("errorBox");
|
||||
|
||||
errorBox.style.display = "none";
|
||||
errorBox.innerText = "";
|
||||
|
||||
// Validasi form
|
||||
if (!username || !email || !password || !confirmPassword) {
|
||||
showError("Semua field harus diisi");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)) {
|
||||
showError("Format email tidak valid");
|
||||
return;
|
||||
}
|
||||
|
||||
if (password.length < 6) {
|
||||
showError("Password minimal 6 karakter");
|
||||
return;
|
||||
}
|
||||
|
||||
if (password !== confirmPassword) {
|
||||
showError("Password dan konfirmasi password tidak cocok");
|
||||
return;
|
||||
}
|
||||
|
||||
// Kirim ke register.php via AJAX
|
||||
fetch("register.php", {
|
||||
method: "POST",
|
||||
headers: {"Content-Type": "application/x-www-form-urlencoded"},
|
||||
body: `username=${encodeURIComponent(username)}&email=${encodeURIComponent(email)}&password=${encodeURIComponent(password)}`
|
||||
})
|
||||
.then(response => response.text())
|
||||
.then(data => {
|
||||
data = data.trim();
|
||||
if (data === "OK") {
|
||||
// registrasi sukses -> redirect ke mainboard.php
|
||||
window.location.href = "mainboard.php";
|
||||
} else {
|
||||
showError(data); // tampilkan error dari PHP
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
showError("Terjadi kesalahan server");
|
||||
console.error(err);
|
||||
});
|
||||
});
|
||||
|
||||
function showError(msg) {
|
||||
const box = document.getElementById("errorBox");
|
||||
box.innerText = msg;
|
||||
box.style.display = "block";
|
||||
}
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
64
register.js
64
register.js
@ -1,64 +0,0 @@
|
||||
document.getElementById("registerForm").addEventListener("submit", function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
let username = document.getElementById("username").value.trim();
|
||||
let email = document.getElementById("email").value.trim();
|
||||
let password = document.getElementById("password").value.trim();
|
||||
let confirmPassword = document.getElementById("confirmPassword").value.trim();
|
||||
let errorBox = document.getElementById("errorBox");
|
||||
|
||||
errorBox.style.display = "none";
|
||||
|
||||
// Validasi
|
||||
if (!username || !email || !password || !confirmPassword) {
|
||||
showError("Semua field harus diisi");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)) {
|
||||
showError("Format email tidak valid");
|
||||
return;
|
||||
}
|
||||
|
||||
if (password.length < 6) {
|
||||
showError("Password minimal 6 karakter");
|
||||
return;
|
||||
}
|
||||
|
||||
if (password !== confirmPassword) {
|
||||
showError("Password dan konfirmasi password tidak cocok");
|
||||
return;
|
||||
}
|
||||
|
||||
let users = JSON.parse(localStorage.getItem("users") || "[]");
|
||||
|
||||
if (users.some(u => u.username === username)) {
|
||||
showError("Username sudah digunakan");
|
||||
return;
|
||||
}
|
||||
|
||||
if (users.some(u => u.email === email)) {
|
||||
showError("Email sudah digunakan");
|
||||
return;
|
||||
}
|
||||
|
||||
// Simpan user baru
|
||||
users.push({
|
||||
id: Date.now().toString(),
|
||||
username,
|
||||
email,
|
||||
password,
|
||||
role: "player"
|
||||
});
|
||||
|
||||
localStorage.setItem("users", JSON.stringify(users));
|
||||
|
||||
alert("Registrasi berhasil! Silakan login.");
|
||||
window.location.href = "login.html";
|
||||
});
|
||||
|
||||
function showError(msg) {
|
||||
let box = document.getElementById("errorBox");
|
||||
box.innerText = msg;
|
||||
box.style.display = "block";
|
||||
}
|
||||
69
register.php
69
register.php
@ -1,55 +1,46 @@
|
||||
<?php
|
||||
if ($_SERVER["REQUEST_METHOD"] === "POST") {
|
||||
// Simpan dengan nama file: register.php
|
||||
include 'Config.php';
|
||||
|
||||
$username = trim($_POST["username"]);
|
||||
$email = trim($_POST["email"]);
|
||||
$password = $_POST["password"];
|
||||
$confirm = $_POST["confirm"];
|
||||
if (isset($_POST['btn-register'])) {
|
||||
$username = $_POST['username'];
|
||||
$email = $_POST['email'];
|
||||
$password = $_POST['password'];
|
||||
$confirm = $_POST['confirm_password'];
|
||||
|
||||
if (!$username || !$email || !$password || !$confirm) {
|
||||
echo "Semua field wajib diisi";
|
||||
exit;
|
||||
}
|
||||
|
||||
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
|
||||
echo "Email tidak valid";
|
||||
if (empty($username) || empty($email) || empty($password) || empty($confirm)) {
|
||||
echo "<script>alert('Semua data harus diisi!'); window.location='index.html';</script>";
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($password !== $confirm) {
|
||||
echo "Password tidak cocok";
|
||||
echo "<script>alert('Password dan Konfirmasi tidak cocok!'); window.location='index.html';</script>";
|
||||
exit;
|
||||
}
|
||||
|
||||
$file = "users.json";
|
||||
$users = file_exists($file) ? json_decode(file_get_contents($file), true) : [];
|
||||
// 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);
|
||||
|
||||
// 🔍 Cek username & email duplikat
|
||||
foreach ($users as $u) {
|
||||
if (strtolower($u["username"]) === strtolower($username)) {
|
||||
echo "Username sudah digunakan";
|
||||
if (mysqli_stmt_num_rows($stmt) > 0) {
|
||||
echo "<script>alert('Username atau Email sudah terpakai!'); window.location='index.html';</script>";
|
||||
exit;
|
||||
}
|
||||
if (strtolower($u["email"]) === strtolower($email)) {
|
||||
echo "Email sudah digunakan";
|
||||
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 "<script>alert('Registrasi Berhasil! Silakan Login.'); window.location='index.html';</script>";
|
||||
} else {
|
||||
echo "Error: " . mysqli_error($conn);
|
||||
}
|
||||
}
|
||||
|
||||
// 🔐 Enkripsi password
|
||||
$hashedPassword = password_hash($password, PASSWORD_BCRYPT);
|
||||
|
||||
// 📌 tambah user baru
|
||||
$users[] = [
|
||||
"id" => uniqid(),
|
||||
"username" => $username,
|
||||
"email" => $email,
|
||||
"password" => $hashedPassword,
|
||||
"role" => "player",
|
||||
"created_at" => date("Y-m-d H:i:s")
|
||||
];
|
||||
|
||||
file_put_contents($file, json_encode($users, JSON_PRETTY_PRINT));
|
||||
echo "success";
|
||||
mysqli_stmt_close($stmtInsert);
|
||||
}
|
||||
?>
|
||||
Loading…
x
Reference in New Issue
Block a user