sss
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
session_start();
|
session_start();
|
||||||
require_once __DIR__ . '/../init.php';
|
require_once __DIR__ . '/init.php';
|
||||||
|
|
||||||
if (!isset($_SESSION['user_id'])) {
|
if (!isset($_SESSION['user_id'])) {
|
||||||
header('Location: auth/login.php');
|
header('Location: auth/login.php');
|
||||||
@@ -29,43 +29,71 @@ $games = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
|||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html lang="it">
|
<html lang="it">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<title>Dashboard - Diplomacy</title>
|
<title>Dashboard - Diplomacy</title>
|
||||||
<link href="assets/css/bootstrap.min.css" rel="stylesheet">
|
<link href="assets/css/bootstrap.min.css" rel="stylesheet">
|
||||||
<link href="assets/css/custom.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>
|
</head>
|
||||||
<body>
|
<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">
|
<div id="content">
|
||||||
<h1 class="mb-4">Benvenuto, <?= htmlspecialchars($user['email']) ?>!</h1>
|
<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 class="mt-4">Le tue partite</h4>
|
||||||
<h4>Le tue partite</h4>
|
<?php if (count($games) === 0): ?>
|
||||||
<?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>
|
||||||
<p>Non stai giocando a nessuna partita. <a href="create_game.php">Crea una nuova partita</a></p>
|
<?php else: ?>
|
||||||
<?php else: ?>
|
<div class="row row-cols-1 row-cols-md-2 g-4 mt-2">
|
||||||
<div class="list-group">
|
<?php foreach ($games as $game): ?>
|
||||||
<?php foreach ($games as $game): ?>
|
<div class="col">
|
||||||
<a href="game.php?id=<?= $game['id'] ?>" class="list-group-item list-group-item-action">
|
<div class="card shadow-sm">
|
||||||
<?= htmlspecialchars($game['name']) ?>
|
<div class="card-body">
|
||||||
<span class="badge bg-secondary float-end"><?= htmlspecialchars($game['status']) ?></span>
|
<h5 class="card-title"><?= htmlspecialchars($game['name']) ?></h5>
|
||||||
<br>
|
<span class="badge bg-secondary"><?= htmlspecialchars($game['status']) ?></span>
|
||||||
<small>Creata il <?= htmlspecialchars($game['created_at']) ?></small>
|
<p class="card-text"><small>Creata il <?= htmlspecialchars($game['created_at']) ?></small></p>
|
||||||
</a>
|
<a href="/game/<?= $game['id'] ?>" class="btn btn-primary btn-sm">Apri partita</a>
|
||||||
<?php endforeach; ?>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
</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>
|
<script src="assets/js/bootstrap.bundle.min.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
Reference in New Issue
Block a user