Initial DEV environment from production snapshot
This commit is contained in:
0
game/create_game.php
Executable file
0
game/create_game.php
Executable file
0
game/create_game_action.php
Executable file
0
game/create_game_action.php
Executable file
99
game/dashboard.php
Executable file
99
game/dashboard.php
Executable file
@@ -0,0 +1,99 @@
|
||||
<?php
|
||||
session_start();
|
||||
require_once __DIR__ . '/init.php';
|
||||
|
||||
if (!isset($_SESSION['user_id'])) {
|
||||
header('Location: auth/login.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
$pdo = getPDO();
|
||||
|
||||
// Info utente
|
||||
$stmt = $pdo->prepare("SELECT id, email, created_at FROM users WHERE id = ?");
|
||||
$stmt->execute([$_SESSION['user_id']]);
|
||||
$user = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
// Partite dell'utente
|
||||
$stmt = $pdo->prepare("
|
||||
SELECT g.id, g.name, g.status, g.created_at
|
||||
FROM games g
|
||||
JOIN game_players gp ON g.id = gp.game_id
|
||||
WHERE gp.user_id = ?
|
||||
ORDER BY g.created_at DESC
|
||||
");
|
||||
$stmt->execute([$_SESSION['user_id']]);
|
||||
$games = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
?>
|
||||
|
||||
<!doctype html>
|
||||
<html lang="it">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Dashboard - Diplomacy</title>
|
||||
<link href="assets/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="assets/css/custom.css" rel="stylesheet">
|
||||
<style>
|
||||
body {
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
}
|
||||
#sidebar {
|
||||
min-width: 250px;
|
||||
max-width: 250px;
|
||||
background-color: #343a40;
|
||||
color: #fff;
|
||||
}
|
||||
#sidebar a {
|
||||
color: #fff;
|
||||
text-decoration: none;
|
||||
}
|
||||
#sidebar a:hover {
|
||||
background-color: #495057;
|
||||
}
|
||||
#content {
|
||||
flex-grow: 1;
|
||||
padding: 20px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="sidebar" class="d-flex flex-column p-3">
|
||||
<h3 class="text-center">Diplomacy</h3>
|
||||
<hr class="text-white">
|
||||
<ul class="nav nav-pills flex-column mb-auto">
|
||||
<li class="nav-item"><a href="/dashboard" class="nav-link active">Dashboard</a></li>
|
||||
<li class="nav-item"><a href="/create_game" class="nav-link">Crea partita</a></li>
|
||||
<li class="nav-item"><a href="/auth/logout" class="nav-link">Logout</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div id="content">
|
||||
<h1>Benvenuto, <?= htmlspecialchars($user['email']) ?>!</h1>
|
||||
<p>Qui puoi vedere le tue partite e creare nuove partite con i tuoi amici.</p>
|
||||
|
||||
<h4 class="mt-4">Le tue partite</h4>
|
||||
<?php if (count($games) === 0): ?>
|
||||
<div class="alert alert-info">Non stai giocando a nessuna partita. <a href="/create_game">Crea una nuova partita</a></div>
|
||||
<?php else: ?>
|
||||
<div class="row row-cols-1 row-cols-md-2 g-4 mt-2">
|
||||
<?php foreach ($games as $game): ?>
|
||||
<div class="col">
|
||||
<div class="card shadow-sm">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title"><?= htmlspecialchars($game['name']) ?></h5>
|
||||
<span class="badge bg-secondary"><?= htmlspecialchars($game['status']) ?></span>
|
||||
<p class="card-text"><small>Creata il <?= htmlspecialchars($game['created_at']) ?></small></p>
|
||||
<a href="/game/<?= $game['id'] ?>" class="btn btn-primary btn-sm">Apri partita</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<script src="assets/js/bootstrap.bundle.min.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
0
game/invite.php
Executable file
0
game/invite.php
Executable file
Reference in New Issue
Block a user