sss
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
session_start();
|
||||
require_once __DIR__ . '/../init.php';
|
||||
require_once __DIR__ . '/init.php';
|
||||
|
||||
if (!isset($_SESSION['user_id'])) {
|
||||
header('Location: auth/login.php');
|
||||
@@ -34,38 +34,66 @@ $games = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
<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>
|
||||
<?php include 'header.php'; ?>
|
||||
<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 class="container mt-5">
|
||||
<h1 class="mb-4">Benvenuto, <?= htmlspecialchars($user['email']) ?>!</h1>
|
||||
<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>
|
||||
|
||||
<div class="mb-4">
|
||||
<h4>Le tue partite</h4>
|
||||
<h4 class="mt-4">Le tue partite</h4>
|
||||
<?php if (count($games) === 0): ?>
|
||||
<p>Non stai giocando a nessuna partita. <a href="create_game.php">Crea una nuova partita</a></p>
|
||||
<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="list-group">
|
||||
<div class="row row-cols-1 row-cols-md-2 g-4 mt-2">
|
||||
<?php foreach ($games as $game): ?>
|
||||
<a href="game.php?id=<?= $game['id'] ?>" class="list-group-item list-group-item-action">
|
||||
<?= htmlspecialchars($game['name']) ?>
|
||||
<span class="badge bg-secondary float-end"><?= htmlspecialchars($game['status']) ?></span>
|
||||
<br>
|
||||
<small>Creata il <?= htmlspecialchars($game['created_at']) ?></small>
|
||||
</a>
|
||||
<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>
|
||||
|
||||
<div>
|
||||
<a href="create_game.php" class="btn btn-primary">Crea nuova partita</a>
|
||||
<a href="auth/logout.php" class="btn btn-secondary">Logout</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php include 'footer.php'; ?>
|
||||
<script src="assets/js/bootstrap.bundle.min.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user