399 lines
11 KiB
PHP
399 lines
11 KiB
PHP
<?php
|
|
include "koneksi.php";
|
|
|
|
$username = $_POST['username'];
|
|
$password = $_POST['password'];
|
|
|
|
$query = "SELECT * FROM users WHERE username='$username'";
|
|
$result = mysqli_query($conn, $query);
|
|
<?php
|
|
include "koneksi.php";
|
|
|
|
$username = $_POST['username'];
|
|
$password = $_POST['password'];
|
|
|
|
$query = "SELECT * FROM users WHERE username='$username'";
|
|
$result = mysqli_query($conn, $query);
|
|
|
|
if (mysqli_num_rows($result) === 1) {
|
|
$row = mysqli_fetch_assoc($result);
|
|
|
|
if (password_verify($password, $row['password'])) {
|
|
echo "success";
|
|
} else {
|
|
echo "wrongpass";
|
|
}
|
|
} else {
|
|
echo "nouser";
|
|
}
|
|
?>
|
|
|
|
if (mysqli_num_rows($result) === 1) {
|
|
$row = mysqli_fetch_assoc($result);
|
|
|
|
if (password_verify($password, $row['password'])) {
|
|
echo "success";
|
|
} else {
|
|
echo "wrongpass";
|
|
}
|
|
} else {
|
|
echo "nouser";
|
|
}
|
|
?>
|
|
|
|
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>OCA Gaming Hub - Login</title>
|
|
<style>
|
|
* {
|
|
margin: 0;
|
|
padding: 0;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
body {
|
|
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
|
background: linear-gradient(135deg, #0a3a1a 0%, #0d5a2a 50%, #0f7a3a 100%);
|
|
min-height: 100vh;
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
position: relative;
|
|
overflow: hidden;
|
|
}
|
|
|
|
/* Card decoration background */
|
|
body::before {
|
|
content: "♠ ♥ ♣ ♦";
|
|
position: absolute;
|
|
font-size: 120px;
|
|
opacity: 0.05;
|
|
top: 10%;
|
|
left: 5%;
|
|
animation: float 6s ease-in-out infinite;
|
|
}
|
|
|
|
body::after {
|
|
content: "21";
|
|
position: absolute;
|
|
font-size: 150px;
|
|
opacity: 0.08;
|
|
bottom: 10%;
|
|
right: 5%;
|
|
animation: float 8s ease-in-out infinite reverse;
|
|
}
|
|
|
|
@keyframes float {
|
|
|
|
0%,
|
|
100% {
|
|
transform: translateY(0px);
|
|
}
|
|
|
|
50% {
|
|
transform: translateY(20px);
|
|
}
|
|
}
|
|
|
|
.container {
|
|
position: relative;
|
|
z-index: 10;
|
|
width: 100%;
|
|
max-width: 400px;
|
|
padding: 20px;
|
|
}
|
|
|
|
.logo {
|
|
text-align: center;
|
|
margin-bottom: 30px;
|
|
}
|
|
|
|
.logo h1 {
|
|
color: #00FF00;
|
|
font-size: 32px;
|
|
text-shadow: 0 0 20px rgba(0, 255, 0, 0.6);
|
|
margin-bottom: 5px;
|
|
letter-spacing: 2px;
|
|
}
|
|
|
|
.logo p {
|
|
color: #88FF88;
|
|
font-size: 12px;
|
|
letter-spacing: 1px;
|
|
}
|
|
|
|
.form-container {
|
|
background: rgba(0, 100, 0, 0.2);
|
|
backdrop-filter: blur(10px);
|
|
border: 2px solid rgba(0, 255, 0, 0.4);
|
|
border-radius: 15px;
|
|
padding: 40px;
|
|
box-shadow: 0 8px 32px 0 rgba(0, 255, 0, 0.2);
|
|
}
|
|
|
|
.form-group {
|
|
margin-bottom: 20px;
|
|
}
|
|
|
|
label {
|
|
display: block;
|
|
color: #00FF00;
|
|
font-size: 14px;
|
|
margin-bottom: 8px;
|
|
font-weight: 600;
|
|
}
|
|
|
|
input {
|
|
width: 100%;
|
|
padding: 12px;
|
|
border: 1px solid rgba(0, 255, 0, 0.5);
|
|
background: rgba(0, 100, 0, 0.1);
|
|
color: #88FF88;
|
|
border-radius: 8px;
|
|
font-size: 14px;
|
|
transition: all 0.3s ease;
|
|
}
|
|
|
|
input::placeholder {
|
|
color: rgba(136, 255, 136, 0.5);
|
|
}
|
|
|
|
input:focus {
|
|
outline: none;
|
|
border-color: #00FF00;
|
|
background: rgba(0, 150, 0, 0.2);
|
|
box-shadow: 0 0 10px rgba(0, 255, 0, 0.5);
|
|
}
|
|
|
|
.button-group {
|
|
display: flex;
|
|
gap: 10px;
|
|
margin-top: 30px;
|
|
align-items: center;
|
|
}
|
|
|
|
.btn {
|
|
padding: 12px;
|
|
border: none;
|
|
border-radius: 8px;
|
|
font-size: 14px;
|
|
font-weight: 600;
|
|
cursor: pointer;
|
|
transition: all 0.3s ease;
|
|
letter-spacing: 1px;
|
|
}
|
|
|
|
.btn-signin {
|
|
background: linear-gradient(135deg, #00FF00, #00CC00);
|
|
color: #000000;
|
|
flex: 1;
|
|
}
|
|
|
|
.btn-signin:hover {
|
|
transform: translateY(-2px);
|
|
box-shadow: 0 6px 20px rgba(0, 255, 0, 0.6);
|
|
}
|
|
|
|
.btn-signup {
|
|
background: rgba(0, 255, 0, 0.2);
|
|
color: #00FF00;
|
|
border: 1px solid #00FF00;
|
|
font-size: 11px;
|
|
padding: 8px 12px;
|
|
min-width: 70px;
|
|
}
|
|
|
|
.btn-signup:hover {
|
|
background: rgba(0, 255, 0, 0.3);
|
|
box-shadow: 0 4px 15px rgba(0, 255, 0, 0.4);
|
|
}
|
|
|
|
.btn-back {
|
|
background: rgba(0, 255, 0, 0.2);
|
|
color: #00FF00;
|
|
border: 1px solid #00FF00;
|
|
font-size: 12px;
|
|
width: 100%;
|
|
margin-top: 15px;
|
|
}
|
|
|
|
.btn-back:hover {
|
|
background: rgba(0, 255, 0, 0.3);
|
|
}
|
|
|
|
.card-icon {
|
|
font-size: 48px;
|
|
text-align: center;
|
|
margin-bottom: 20px;
|
|
animation: pulse 2s ease-in-out infinite;
|
|
}
|
|
|
|
@keyframes pulse {
|
|
|
|
0%,
|
|
100% {
|
|
transform: scale(1);
|
|
}
|
|
|
|
50% {
|
|
transform: scale(1.1);
|
|
}
|
|
}
|
|
|
|
.success-message {
|
|
color: #00FF00;
|
|
font-size: 12px;
|
|
text-align: center;
|
|
margin-top: 15px;
|
|
display: none;
|
|
}
|
|
|
|
.success-message.show {
|
|
display: block;
|
|
}
|
|
|
|
.error-message {
|
|
color: #FF6B6B;
|
|
font-size: 12px;
|
|
text-align: center;
|
|
margin-top: 15px;
|
|
display: none;
|
|
}
|
|
|
|
.error-message.show {
|
|
display: block;
|
|
}
|
|
</style>
|
|
</head>
|
|
|
|
<body>
|
|
<div class="container">
|
|
<div class="logo">
|
|
<h1>♠ OCA GAMING HUB ♠</h1>
|
|
<p>BLACKJACK 21 CARD GAME</p>
|
|
</div>
|
|
|
|
<div class="form-container">
|
|
<div class="card-icon">🂡</div>
|
|
|
|
<!-- Main Page - Login Form -->
|
|
<div id="mainPage">
|
|
<div class="form-group">
|
|
<label for="mainUsername">Username</label>
|
|
<input type="text" id="mainUsername" placeholder="Enter your username" required>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="mainPassword">Password</label>
|
|
<input type="password" id="mainPassword" placeholder="Enter your password" required>
|
|
</div>
|
|
|
|
<div class="button-group">
|
|
<button type="button" class="btn btn-signin" onclick="handleLogin()">Login</button>
|
|
<button type="button" class="btn btn-signup" onclick="goToSignUp()">Sign Up</button>
|
|
</div>
|
|
|
|
<div class="success-message" id="mainMessage"></div>
|
|
<div class="error-message" id="mainError"></div>
|
|
</div>
|
|
|
|
<!-- Sign Up Page -->
|
|
<form id="signupForm" style="display: none;">
|
|
<div class="form-group">
|
|
<label for="signupUsername">Username</label>
|
|
<input type="text" id="signupUsername" placeholder="Create a username" required>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="signupEmail">Email</label>
|
|
<input type="email" id="signupEmail" placeholder="Enter your email" required>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="signupPassword">Password</label>
|
|
<input type="password" id="signupPassword" placeholder="Create a password" required>
|
|
</div>
|
|
|
|
<button type="submit" class="btn btn-signin" style="width: 100%;">Create Account</button>
|
|
<button type="button" class="btn btn-back" onclick="goToMain()">Back</button>
|
|
|
|
<div class="success-message" id="signupMessage"></div>
|
|
<div class="error-message" id="signupError"></div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
function goToMain() {
|
|
document.getElementById('mainPage').style.display = 'block';
|
|
document.getElementById('signupForm').style.display = 'none';
|
|
// Clear messages
|
|
document.getElementById('mainMessage').classList.remove('show');
|
|
document.getElementById('mainError').classList.remove('show');
|
|
}
|
|
|
|
function goToSignUp() {
|
|
document.getElementById('mainPage').style.display = 'none';
|
|
document.getElementById('signupForm').style.display = 'block';
|
|
}
|
|
|
|
// Login handler: validate input and show messages
|
|
function handleLogin() {
|
|
const username = document.getElementById('mainUsername').value.trim();
|
|
const password = document.getElementById('mainPassword').value.trim();
|
|
const successEl = document.getElementById('mainMessage');
|
|
const errorEl = document.getElementById('mainError');
|
|
|
|
// Reset messages
|
|
successEl.classList.remove('show');
|
|
errorEl.classList.remove('show');
|
|
|
|
if (!username || !password) {
|
|
errorEl.textContent = 'Please enter both username and password.';
|
|
errorEl.classList.add('show');
|
|
return;
|
|
}
|
|
|
|
// Simulate login (replace with real auth as needed)
|
|
if (username.toLowerCase() === 'admin' && password === 'admin') {
|
|
successEl.textContent = `Welcome back, ${username}! Redirecting...`;
|
|
successEl.classList.add('show');
|
|
setTimeout(() => {
|
|
alert('Logged in as ' + username + '. (Simulated)');
|
|
// Example: redirect to game/dashboard page
|
|
// window.location.href = 'dashboard.html';
|
|
}, 800);
|
|
} else {
|
|
errorEl.textContent = 'Invalid username or password.';
|
|
errorEl.classList.add('show');
|
|
}
|
|
}
|
|
|
|
// Signup Form Handler
|
|
document.getElementById('signupForm').addEventListener('submit', function (e) {
|
|
e.preventDefault();
|
|
const username = document.getElementById('signupUsername').value;
|
|
const email = document.getElementById('signupEmail').value;
|
|
const password = document.getElementById('signupPassword').value;
|
|
|
|
if (username && email && password) {
|
|
const message = document.getElementById('signupMessage');
|
|
message.textContent = `✓ Account created successfully for ${username}!`;
|
|
message.classList.add('show');
|
|
|
|
setTimeout(() => {
|
|
alert(`Account created!\nUsername: ${username}\nEmail: ${email}`);
|
|
// Add your redirect here
|
|
goToMain();
|
|
}, 1500);
|
|
}
|
|
});
|
|
</script>
|
|
</body>
|
|
|
|
</html>
|