Compare commits
2 Commits
37ecefe0c5
...
33348b7bf7
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
33348b7bf7 | ||
|
|
019933ff5a |
@ -1,47 +1,3 @@
|
|||||||
<?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>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
|
||||||
230
login.css
Normal file
230
login.css
Normal file
@ -0,0 +1,230 @@
|
|||||||
|
* {
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Register button: filled theme matching sign-in but slightly darker */
|
||||||
|
.btn-register {
|
||||||
|
background: linear-gradient(135deg, #00cc33, #009922);
|
||||||
|
color: #000000;
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-register:hover {
|
||||||
|
transform: translateY(-2px);
|
||||||
|
box-shadow: 0 8px 24px rgba(0, 200, 120, 0.45);
|
||||||
|
}
|
||||||
|
|
||||||
|
.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;
|
||||||
|
}
|
||||||
62
loginn.php
Normal file
62
loginn.php
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
<?php
|
||||||
|
include "koneksi.php";
|
||||||
|
$error = '';
|
||||||
|
if(isset($_POST['login'])){
|
||||||
|
$username = $_POST['username'];
|
||||||
|
$password = $_POST['password'];
|
||||||
|
|
||||||
|
$sql = "SELECT * FROM users WHERE username='$username' AND password='$password'";
|
||||||
|
$result = mysqli_query($conn, $sql);
|
||||||
|
|
||||||
|
if (mysqli_num_rows($result) > 0) {
|
||||||
|
header("Location: html.php" );
|
||||||
|
exit;
|
||||||
|
} else {
|
||||||
|
$error = 'Invalid username or password.';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<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">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="container">
|
||||||
|
<div class="logo">
|
||||||
|
<h1>OCAGamingHub</h1>
|
||||||
|
<p>Welcome back — sign in to continue</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-container">
|
||||||
|
<div class="card-icon">♠</div>
|
||||||
|
|
||||||
|
<?php if(!empty($error)): ?>
|
||||||
|
<div class="error-message show"><?=htmlspecialchars($error)?></div>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<form action="loginn.php" method="POST">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="username">Username</label>
|
||||||
|
<input id="username" name="username" type="text" placeholder="Enter username" required>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="password">Password</label>
|
||||||
|
<input id="password" name="password" type="password" placeholder="Enter password" required>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="button-group">
|
||||||
|
<button type="submit" name="login" class="btn btn-signin">Sign In</button>
|
||||||
|
<a href="register.php" class="btn btn-signup">Sign Up</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
127
register.php
Normal file
127
register.php
Normal file
@ -0,0 +1,127 @@
|
|||||||
|
<?php
|
||||||
|
include 'koneksi.php';
|
||||||
|
|
||||||
|
if (isset($_POST['register'])) {
|
||||||
|
$username = $_POST['username'];
|
||||||
|
$password = $_POST['password'];
|
||||||
|
|
||||||
|
$SQL = "INSERT INTO users (username, password) VALUES ('$username', '$password')";
|
||||||
|
$result = mysqli_query($conn, $SQL);
|
||||||
|
|
||||||
|
header("Location: loginn.php");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<!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>
|
||||||
|
<link rel="stylesheet" href="login.css">
|
||||||
|
</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 -->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Sign Up Page -->
|
||||||
|
<form action ="register.php" method="POST">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="username">Username</label>
|
||||||
|
<input id="username" type="text" name="username" required>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="password">Password</label>
|
||||||
|
<input id="password" type="password" name="password" required>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="button-group">
|
||||||
|
<button type="submit" name="register" class="btn btn-register">Daftar</button>
|
||||||
|
</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>
|
||||||
16
signup.php
16
signup.php
@ -1,16 +0,0 @@
|
|||||||
<?php
|
|
||||||
include "koneksi.php";
|
|
||||||
|
|
||||||
$username = $_POST['username'];
|
|
||||||
$email = $_POST['email'];
|
|
||||||
$password = password_hash($_POST['password'], PASSWORD_DEFAULT);
|
|
||||||
|
|
||||||
$query = "INSERT INTO users (username,email,password) VALUES('$username','$email','$password')";
|
|
||||||
$result = mysqli_query($conn, $query);
|
|
||||||
|
|
||||||
if ($result) {
|
|
||||||
echo "success";
|
|
||||||
} else {
|
|
||||||
echo "error";
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
Loading…
x
Reference in New Issue
Block a user