revert c18de9ad4dad6e9600bd3d07f444a56c673c638f
revert add board.php
This commit is contained in:
parent
c18de9ad4d
commit
30d62eb967
1
includes/.htaccess
Normal file
1
includes/.htaccess
Normal file
@ -0,0 +1 @@
|
|||||||
|
deny from all
|
||||||
13
includes/config.php
Normal file
13
includes/config.php
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<?php
|
||||||
|
$host = "localhost";
|
||||||
|
$user = "root";
|
||||||
|
$pass = "";
|
||||||
|
$db = "hitnrun";
|
||||||
|
|
||||||
|
$conn = new mysqli($host, $user, $pass, $db);
|
||||||
|
|
||||||
|
if ($conn->connect_error) {
|
||||||
|
die("Connection failed: " . $conn->connect_error);
|
||||||
|
}
|
||||||
|
|
||||||
|
session_start();
|
||||||
8
public/.htaccess
Normal file
8
public/.htaccess
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
RewriteEngine On
|
||||||
|
|
||||||
|
# Don't rewrite existing files or directories
|
||||||
|
RewriteCond %{REQUEST_FILENAME} !-f
|
||||||
|
RewriteCond %{REQUEST_FILENAME} !-d
|
||||||
|
|
||||||
|
# Redirect everything else to index.php
|
||||||
|
RewriteRule ^(.*)$ index.php [L]
|
||||||
271
public/assets/css/style.css
Normal file
271
public/assets/css/style.css
Normal file
@ -0,0 +1,271 @@
|
|||||||
|
body, html{
|
||||||
|
font-family: Inter, ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial;
|
||||||
|
margin:0;
|
||||||
|
background: radial-gradient(circle at 10% 10%, rgba(255,255,255,0.03), transparent 5%),
|
||||||
|
linear-gradient(180deg, #000 0%, #071827 100%),
|
||||||
|
var(--bg);
|
||||||
|
color:var(--muted);
|
||||||
|
-webkit-font-smoothing:antialiased;
|
||||||
|
-moz-osx-font-smoothing:grayscale;
|
||||||
|
padding:24px;
|
||||||
|
display:flex;
|
||||||
|
align-items:center;
|
||||||
|
justify-content:center;
|
||||||
|
height:100%;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
:root{
|
||||||
|
--bg:#071827;
|
||||||
|
--card:#071827;
|
||||||
|
--accent:#ffd54a;
|
||||||
|
--muted:#cfe8d6;
|
||||||
|
--glass: rgba(255,255,255,0.04);
|
||||||
|
--shadow: 0 6px 18px rgba(2,8,3,0.6);
|
||||||
|
--glass-2: rgba(0,0,0,0.35);
|
||||||
|
}
|
||||||
|
|
||||||
|
.container{
|
||||||
|
width:100%;
|
||||||
|
background:linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
|
||||||
|
border-radius:16px;
|
||||||
|
padding:20px;
|
||||||
|
box-shadow:var(--shadow);
|
||||||
|
backdrop-filter: blur(6px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.card{
|
||||||
|
background:rgba(255,255,255,0.05);
|
||||||
|
padding:28px;
|
||||||
|
border-radius:16px;
|
||||||
|
width:320px;
|
||||||
|
box-shadow:0 8px 30px rgba(0,0,0,0.5);
|
||||||
|
backdrop-filter:blur(8px);
|
||||||
|
}
|
||||||
|
|
||||||
|
h2{
|
||||||
|
margin-top:0;
|
||||||
|
text-align:center
|
||||||
|
}
|
||||||
|
|
||||||
|
label{
|
||||||
|
display:block;
|
||||||
|
margin:10px 0 4px;
|
||||||
|
font-size:14px
|
||||||
|
}
|
||||||
|
|
||||||
|
input{
|
||||||
|
width:100%;
|
||||||
|
padding:10px;
|
||||||
|
border-radius:8px;
|
||||||
|
border:0;
|
||||||
|
margin-bottom:10px;
|
||||||
|
background:#ffffff12;
|
||||||
|
color:white;
|
||||||
|
}
|
||||||
|
|
||||||
|
button{
|
||||||
|
width:100%;
|
||||||
|
padding:10px;
|
||||||
|
border-radius:8px;
|
||||||
|
border:0;
|
||||||
|
cursor:pointer;
|
||||||
|
background:linear-gradient(90deg,#ffd54a);
|
||||||
|
color:black;
|
||||||
|
font-weight:600;
|
||||||
|
margin-top:10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.note{
|
||||||
|
text-align:center;
|
||||||
|
margin-top:10px;
|
||||||
|
font-size:14px
|
||||||
|
}
|
||||||
|
|
||||||
|
a{
|
||||||
|
color:#4ade80;
|
||||||
|
text-decoration:none
|
||||||
|
}
|
||||||
|
|
||||||
|
.logo{
|
||||||
|
font-size: 96px;
|
||||||
|
display:flex;
|
||||||
|
align-items:center;
|
||||||
|
justify-content:center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header{
|
||||||
|
display:flex;
|
||||||
|
gap:16px;
|
||||||
|
align-items:center;
|
||||||
|
margin-bottom:14px
|
||||||
|
}
|
||||||
|
|
||||||
|
.w80{
|
||||||
|
width: 80%;
|
||||||
|
}
|
||||||
|
|
||||||
|
table{
|
||||||
|
width:100%;
|
||||||
|
border-collapse:collapse;
|
||||||
|
font-size:14px
|
||||||
|
}
|
||||||
|
|
||||||
|
thead th{
|
||||||
|
font-size:12px;
|
||||||
|
text-align:left;
|
||||||
|
padding:8px 10px;
|
||||||
|
color:var(--muted);
|
||||||
|
opacity:0.9
|
||||||
|
}
|
||||||
|
|
||||||
|
tbody td{
|
||||||
|
padding:10px;
|
||||||
|
border-top:1px dashed rgba(255,255,255,0.03)
|
||||||
|
}
|
||||||
|
|
||||||
|
.panel{
|
||||||
|
background:var(--card);
|
||||||
|
padding:16px;
|
||||||
|
border-radius:12px;
|
||||||
|
border:1px solid var(--glass-2)
|
||||||
|
}
|
||||||
|
|
||||||
|
footer{
|
||||||
|
margin-top:14px;
|
||||||
|
font-size:12px;
|
||||||
|
color:rgba(255,255,255,0.45);
|
||||||
|
text-align:center
|
||||||
|
}
|
||||||
|
|
||||||
|
.userbox {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 14px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
background: rgba(255, 255, 255, 0.04);
|
||||||
|
padding: 14px;
|
||||||
|
border-radius: 14px;
|
||||||
|
border: 1px solid rgba(255, 255, 255, 0.06);
|
||||||
|
box-shadow: 0 8px 24px rgba(2, 6, 23, 0.45);
|
||||||
|
}
|
||||||
|
|
||||||
|
.userbox .avatar {
|
||||||
|
width: 58px;
|
||||||
|
height: 58px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: linear-gradient(180deg, #0e3b33, #0b2a2f);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
font-size: 22px;
|
||||||
|
font-weight: 800;
|
||||||
|
color: var(--accent);
|
||||||
|
border: 2px solid rgba(246,198,79,0.4);
|
||||||
|
box-shadow: 0 6px 14px rgba(0,0,0,0.5);
|
||||||
|
}
|
||||||
|
|
||||||
|
.userbox .info {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
line-height: 1.25;
|
||||||
|
}
|
||||||
|
|
||||||
|
.userbox .name {
|
||||||
|
font-weight: 800;
|
||||||
|
font-size: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.userbox .saldo {
|
||||||
|
margin-top: 4px;
|
||||||
|
font-size: 18px;
|
||||||
|
color: var(--muted);
|
||||||
|
}
|
||||||
|
|
||||||
|
.userbox .saldo span {
|
||||||
|
color: var(--accent);
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
.userbox .status {
|
||||||
|
margin-top: 2px;
|
||||||
|
font-size: 16px;
|
||||||
|
color: var(--muted);
|
||||||
|
}
|
||||||
|
|
||||||
|
.gamename {
|
||||||
|
font-size: 36px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.num-box {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
border: 1px solid #444;
|
||||||
|
border-radius: 12px;
|
||||||
|
overflow: hidden;
|
||||||
|
background: #1e1e1e;
|
||||||
|
height: 50px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.num-box input {
|
||||||
|
height: 50px;
|
||||||
|
width: 100px;
|
||||||
|
font-size: 18px;
|
||||||
|
background: transparent;
|
||||||
|
border: none;
|
||||||
|
color: white;
|
||||||
|
text-align: center;
|
||||||
|
outline: none;
|
||||||
|
line-height: 50px; /* base centering */
|
||||||
|
display: flex; /* optical fix */
|
||||||
|
align-items: center; /* optical fix */
|
||||||
|
justify-content: center; /* ensures centered horizontally */
|
||||||
|
}
|
||||||
|
|
||||||
|
.num-box input::-webkit-inner-spin-button,
|
||||||
|
.num-box input::-webkit-outer-spin-button {
|
||||||
|
-webkit-appearance: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.num-box .btn {
|
||||||
|
width: 50px;
|
||||||
|
height: 50px;
|
||||||
|
border: none;
|
||||||
|
background: #2b2b2b;
|
||||||
|
color: white;
|
||||||
|
font-size: 22px;
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.num-box .btn:hover {
|
||||||
|
background: #3a3a3a;
|
||||||
|
}
|
||||||
|
|
||||||
|
.num-box .btn:active {
|
||||||
|
background: #555;
|
||||||
|
}
|
||||||
|
|
||||||
|
.plus, .minus {
|
||||||
|
margin-top: 0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mb16 {
|
||||||
|
margin-bottom: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Chrome, Edge, Safari */
|
||||||
|
input::-webkit-outer-spin-button,
|
||||||
|
input::-webkit-inner-spin-button {
|
||||||
|
-webkit-appearance: none;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Firefox */
|
||||||
|
input[type="number"] {
|
||||||
|
-moz-appearance: textfield; /* old syntax */
|
||||||
|
appearance: textfield; /* standard property */
|
||||||
|
}
|
||||||
27
public/assets/js/menu.js
Normal file
27
public/assets/js/menu.js
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
document.querySelector(".plus").addEventListener("click", () => {
|
||||||
|
const input = document.querySelector(".num-box input");
|
||||||
|
const step = Number(input.step) || 1000;
|
||||||
|
const max = Number(input.max);
|
||||||
|
|
||||||
|
let newValue = Number(input.value) + step;
|
||||||
|
|
||||||
|
if (!isNaN(max)) {https://git-eng.ukwms.ac.id/2526-web/Kelompok_13.git
|
||||||
|
newValue = Math.min(newValue, max);
|
||||||
|
}
|
||||||
|
|
||||||
|
input.value = newValue;
|
||||||
|
});
|
||||||
|
|
||||||
|
document.querySelector(".minus").addEventListener("click", () => {
|
||||||
|
const input = document.querySelector(".num-box input");
|
||||||
|
const step = Number(input.step) || 1000;
|
||||||
|
const min = Number(input.min);
|
||||||
|
|
||||||
|
let newValue = Number(input.value) - step;
|
||||||
|
|
||||||
|
if (!isNaN(min)) {
|
||||||
|
newValue = Math.max(newValue, min);
|
||||||
|
}
|
||||||
|
|
||||||
|
input.value = newValue;
|
||||||
|
});
|
||||||
@ -1,127 +0,0 @@
|
|||||||
<?php
|
|
||||||
ini_set('display_errors', 1);
|
|
||||||
ini_set('display_startup_errors', 1);
|
|
||||||
error_reporting(E_ALL);
|
|
||||||
require_once "../includes/config.php";
|
|
||||||
|
|
||||||
// Top 10 bets
|
|
||||||
$stmt = $conn->prepare("SELECT b.bet, u.username FROM bets b JOIN users u ON b.uid = u.uid ORDER BY b.bet DESC LIMIT 10;");
|
|
||||||
$stmt->execute();
|
|
||||||
$result = $stmt->get_result();
|
|
||||||
$bets = $result->fetch_all(MYSQLI_ASSOC);
|
|
||||||
$stmt->close();
|
|
||||||
|
|
||||||
// Top 10 wins
|
|
||||||
$stmt = $conn->prepare("SELECT b.win, u.username FROM wins b JOIN users u ON b.uid = u.uid ORDER BY b.win DESC LIMIT 10;");
|
|
||||||
$stmt->execute();
|
|
||||||
$result = $stmt->get_result();
|
|
||||||
$wins = $result->fetch_all(MYSQLI_ASSOC);
|
|
||||||
$stmt->close();
|
|
||||||
|
|
||||||
// Top 10 users by money
|
|
||||||
$stmt = $conn->prepare("SELECT * FROM users ORDER BY money DESC LIMIT 10");
|
|
||||||
$stmt->execute();
|
|
||||||
$result = $stmt->get_result();
|
|
||||||
$users = $result->fetch_all(MYSQLI_ASSOC);
|
|
||||||
$stmt->close();
|
|
||||||
|
|
||||||
?>
|
|
||||||
<!doctype html>
|
|
||||||
<html lang="id">
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
||||||
<title>Hit and Run — Leaderboard</title>
|
|
||||||
<link rel="stylesheet" href="assets/css/style.css">
|
|
||||||
</head>
|
|
||||||
<body style="width: 100%;">
|
|
||||||
<div class="container w80">
|
|
||||||
<div class="header">
|
|
||||||
<div class="logo">🂡</div>
|
|
||||||
<div class="title">
|
|
||||||
<h2>Hit Or Run — Leaderboard</h2>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="board mb16">
|
|
||||||
<div class="panel">
|
|
||||||
<h3>Top Rich Mans</h3>
|
|
||||||
<div id="leaderboard-wrap">
|
|
||||||
<table id="leaderboard">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th style="width: 20%; font-size: 18px" class="rank">#</th>
|
|
||||||
<th style="width: 40%; font-size: 20px" >Player</th>
|
|
||||||
<th style="width: 40%; font-size: 20px">Earnings</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody class="board-body">
|
|
||||||
<?php foreach ($users as $index => $user): ?>
|
|
||||||
<tr>
|
|
||||||
<td><?= $index + 1 ?></td>
|
|
||||||
<td style="font-size: 18px"><?= htmlspecialchars($user['username']) ?></td>
|
|
||||||
<td style="font-size: 18px"><?= htmlspecialchars($user['money']) ?></td>
|
|
||||||
</tr>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="board mb16">
|
|
||||||
<div class="panel">
|
|
||||||
<h3>Top Crazy Mans</h3>
|
|
||||||
<div id="leaderboard-wrap">
|
|
||||||
<table id="leaderboard">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th style="width: 20%; font-size: 18px" class="rank">#</th>
|
|
||||||
<th style="width: 40%; font-size: 20px" >Player</th>
|
|
||||||
<th style="width: 40%; font-size: 20px >Bets</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody class="board-body">
|
|
||||||
<?php foreach ($bets as $index => $bet): ?>
|
|
||||||
<tr>
|
|
||||||
<td><?= $index + 1 ?></td>
|
|
||||||
<td><?= htmlspecialchars($bet['username']) ?></td>
|
|
||||||
<td><?= htmlspecialchars($bet['bet']) ?></td>
|
|
||||||
</tr>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="board mb16">
|
|
||||||
<div class="panel">
|
|
||||||
<h3>Top Lucky Mans</h3>
|
|
||||||
<div id="leaderboard-wrap">
|
|
||||||
<table id="leaderboard">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th style="width: 20%; font-size: 18px" class="rank">#</th>
|
|
||||||
<th style="width: 40%; font-size: 20px" >Player</th>
|
|
||||||
<th style="width: 40%; font-size: 20px" >Earnings</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody class="board-body">
|
|
||||||
<?php foreach ($wins as $index => $win): ?>
|
|
||||||
<tr>
|
|
||||||
<td><?= $index + 1 ?></td>
|
|
||||||
<td><?= htmlspecialchars($win['username']) ?></td>
|
|
||||||
<td><?= htmlspecialchars($win['win']) ?></td>
|
|
||||||
</tr>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<footer>© 2025 Hit Or Run Leaderboard</footer>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@ -50,17 +50,17 @@
|
|||||||
<table id="leaderboard">
|
<table id="leaderboard">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th style="width: 20%; font-size: 18px" class="rank">#</th>
|
<th class="rank">#</th>
|
||||||
<th style="width: 40%; font-size: 20px" >Player</th>
|
<th>Player</th>
|
||||||
<th style="width: 40%; font-size: 20px">Earnings</th>
|
<th>Earnings</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody class="board-body">
|
<tbody id="board-body">
|
||||||
<?php foreach ($users as $index => $user): ?>
|
<?php foreach ($users as $index => $user): ?>
|
||||||
<tr>
|
<tr>
|
||||||
<td><?= $index + 1 ?></td>
|
<td><?= $index + 1 ?></td>
|
||||||
<td style="font-size: 18px"><?= htmlspecialchars($user['username']) ?></td>
|
<td><?= htmlspecialchars($user['username']) ?></td>
|
||||||
<td style="font-size: 18px"><?= htmlspecialchars($user['money']) ?></td>
|
<td><?= htmlspecialchars($user['money']) ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</tbody>
|
</tbody>
|
||||||
@ -76,12 +76,12 @@
|
|||||||
<table id="leaderboard">
|
<table id="leaderboard">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th style="width: 20%; font-size: 18px" class="rank">#</th>
|
<th class="rank">#</th>
|
||||||
<th style="width: 40%; font-size: 20px" >Player</th>
|
<th>Player</th>
|
||||||
<th style="width: 40%; font-size: 20px >Bets</th>
|
<th>Bets</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody class="board-body">
|
<tbody id="board-body">
|
||||||
<?php foreach ($bets as $index => $bet): ?>
|
<?php foreach ($bets as $index => $bet): ?>
|
||||||
<tr>
|
<tr>
|
||||||
<td><?= $index + 1 ?></td>
|
<td><?= $index + 1 ?></td>
|
||||||
@ -102,12 +102,12 @@
|
|||||||
<table id="leaderboard">
|
<table id="leaderboard">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th style="width: 20%; font-size: 18px" class="rank">#</th>
|
<th class="rank">#</th>
|
||||||
<th style="width: 40%; font-size: 20px" >Player</th>
|
<th>Player</th>
|
||||||
<th style="width: 40%; font-size: 20px" >Earnings</th>
|
<th>Earnings</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody class="board-body">
|
<tbody id="board-body">
|
||||||
<?php foreach ($wins as $index => $win): ?>
|
<?php foreach ($wins as $index => $win): ?>
|
||||||
<tr>
|
<tr>
|
||||||
<td><?= $index + 1 ?></td>
|
<td><?= $index + 1 ?></td>
|
||||||
|
|||||||
65
public/index.php
Normal file
65
public/index.php
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
<?php
|
||||||
|
require "../includes/config.php";
|
||||||
|
|
||||||
|
if (!isset($_SESSION["data"])) {
|
||||||
|
header("Location: signin");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get money
|
||||||
|
$stmt = $conn->prepare("SELECT money FROM users WHERE uid = ?");
|
||||||
|
$stmt->bind_param("i", $_SESSION['data']['uid']);
|
||||||
|
$stmt->execute();
|
||||||
|
$result = $stmt->get_result();
|
||||||
|
$user = $result->fetch_assoc();
|
||||||
|
$stmt->close();
|
||||||
|
|
||||||
|
// Update session
|
||||||
|
$_SESSION['data']['money'] = $user['money'];
|
||||||
|
?>
|
||||||
|
|
||||||
|
<!doctype html>
|
||||||
|
<html lang="id">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
|
<title>Hit & Run</title>
|
||||||
|
<link rel="stylesheet" href="assets/css/style.css">
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div style="padding-right: 32px;">
|
||||||
|
<div class="gamename card">
|
||||||
|
Hit & Run <br>
|
||||||
|
Hit or you Lose.
|
||||||
|
</div>
|
||||||
|
<div style="padding-top: 32px; display:flex; flex-direction:column; align-items:center;">
|
||||||
|
<div class="num-box">
|
||||||
|
<button class="btn minus">-</button>
|
||||||
|
<input min="1000" max="<?php echo $_SESSION['data']['money']; ?>"type="number" value="1000" style="margin-bottom: -1px;">
|
||||||
|
<button class="btn plus">+</button>
|
||||||
|
</div>
|
||||||
|
<button class="btn btn-primary" id="playBtn">▶️ MAINKAN</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<div class="userbox">
|
||||||
|
<div class="avatar">P</div>
|
||||||
|
|
||||||
|
<div class="info">
|
||||||
|
<div class="name"><?php echo $_SESSION['data']["username"]; ?></div>
|
||||||
|
<div class="saldo">Saldo: <span><?php echo $_SESSION['data']["money"]; ?></span></div>
|
||||||
|
<div class="status">Status: Masih Pemula Banghh....</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
const playBtn = document.getElementById('playBtn');
|
||||||
|
console.log("Startgame");
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
<script src="assets/js/menu.js"></script>
|
||||||
|
</html>
|
||||||
5
public/logout.php
Normal file
5
public/logout.php
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<?php
|
||||||
|
session_start();
|
||||||
|
session_destroy();
|
||||||
|
header("Location: signin.php");
|
||||||
|
exit;
|
||||||
58
public/signin.php
Normal file
58
public/signin.php
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
<?php
|
||||||
|
require_once "../includes/config.php";
|
||||||
|
|
||||||
|
if ($_SERVER["REQUEST_METHOD"] === "POST") {
|
||||||
|
$username = trim($_POST["username"]);
|
||||||
|
$password = $_POST["password"];
|
||||||
|
|
||||||
|
$stmt = $conn->prepare("SELECT * FROM users WHERE username = ?");
|
||||||
|
$stmt->bind_param("s", $username);
|
||||||
|
$stmt->execute();
|
||||||
|
|
||||||
|
$result = $stmt->get_result();
|
||||||
|
|
||||||
|
if ($result->num_rows === 1) {
|
||||||
|
$user = $result->fetch_assoc();
|
||||||
|
|
||||||
|
if (password_verify($password, $user["password"])) {
|
||||||
|
$_SESSION["data"] = $user;
|
||||||
|
header("Location: home");
|
||||||
|
exit;
|
||||||
|
} else {
|
||||||
|
$error = "Wrong Username or Password.";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$error = "Username not found.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<!doctype html>
|
||||||
|
<html lang="id">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
|
<title>Hit or Run — Sign In</title>
|
||||||
|
<link rel="stylesheet" href="assets/css/style.css">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="card">
|
||||||
|
<div class="logo">🂡</div>
|
||||||
|
<h2>Hit or Run</h2>
|
||||||
|
|
||||||
|
<?php if (!empty($error)) echo "<p style='color:red;'>$error</p>"; ?>
|
||||||
|
|
||||||
|
<form action="" method="post">
|
||||||
|
<label>Username</label>
|
||||||
|
<input type="text" id="username" name="username" placeholder="Masukkan username" />
|
||||||
|
|
||||||
|
<label>Password</label>
|
||||||
|
<input type="password" id="password" name="password" placeholder="Masukkan password" />
|
||||||
|
|
||||||
|
<button type="submit">Sign In</button>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<div class="note">Belum punya akun? <a href="signup.php">Sign Up!</a></div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
56
public/signup.php
Normal file
56
public/signup.php
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
<?php
|
||||||
|
ini_set('display_errors', 1);
|
||||||
|
ini_set('display_startup_errors', 1);
|
||||||
|
error_reporting(E_ALL);
|
||||||
|
require_once "../includes/config.php";
|
||||||
|
|
||||||
|
if ($_SERVER["REQUEST_METHOD"] === "POST") {
|
||||||
|
$username = trim($_POST["username"]);
|
||||||
|
$password = password_hash($_POST["password"], PASSWORD_DEFAULT);
|
||||||
|
|
||||||
|
// Insert using prepared statement (safe)
|
||||||
|
$stmt = $conn->prepare("INSERT INTO users (username, password) VALUES (?, ?)");
|
||||||
|
$stmt->bind_param("ss", $username, $password);
|
||||||
|
|
||||||
|
try {
|
||||||
|
$stmt->execute();
|
||||||
|
header("Location: signin.php");
|
||||||
|
exit;
|
||||||
|
} catch (mysqli_sql_exception $e) {
|
||||||
|
if ($e->getCode() == 1062) {
|
||||||
|
$error = "Username already exists.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<!doctype html>
|
||||||
|
<html lang="id">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
|
<title>Hit or Run — Sign Up</title>
|
||||||
|
<link rel="stylesheet" href="assets/css/style.css">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="card">
|
||||||
|
<div class="logo">🂡</div>
|
||||||
|
<h2>Hit or Run</h2>
|
||||||
|
|
||||||
|
<?php if (!empty($error)) echo "<p style='color:red;'>$error</p>"; ?>
|
||||||
|
|
||||||
|
<form action="" method="post">
|
||||||
|
<label>Username</label>
|
||||||
|
<input type="text" id="username" name="username" placeholder="Masukkan username" />
|
||||||
|
|
||||||
|
<label>Password</label>
|
||||||
|
<input type="password" id="password" name="password" placeholder="Masukkan password" />
|
||||||
|
|
||||||
|
<button type="submit">Sign Up</button>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<div class="note">Sudah punya akun? <a href="signin.php">Sign In!</a></div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Loading…
x
Reference in New Issue
Block a user