Files

150 lines
3.5 KiB
PHP

<head>
<style>
/* Reset e Font */
body {
font-family: 'Segoe UI', Arial, sans-serif;
background-color: #f0f2f5;
color: #333;
display: flex;
flex-direction: column;
align-items: center;
padding: 40px 20px;
margin: 0;
}
/* Contenitore per Form e Tabelle */
.box {
background: #fff;
padding: 25px;
border-radius: 10px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
width: 100%;
max-width: 500px;
/* Più stretto per i form */
margin-bottom: 20px;
}
/* Estensione per la tabella (più larga) */
.wide-box {
max-width: 800px;
}
h2 {
margin-top: 0;
color: #1c1e21;
text-align: center;
}
/* Stile Input e Bottoni */
input {
width: 100%;
padding: 12px;
margin: 10px 0;
border: 1px solid #ddd;
border-radius: 6px;
box-sizing: border-box;
/* Importante per il padding */
}
button {
width: 100%;
padding: 12px;
background-color: #007bff;
border: none;
border-radius: 6px;
color: white;
font-weight: bold;
cursor: pointer;
font-size: 16px;
}
button:hover {
background-color: #0056b3;
}
/* Tabella */
table {
width: 100%;
border-collapse: collapse;
margin-top: 20px;
}
th,
td {
text-align: left;
padding: 12px;
border-bottom: 1px solid #eee;
}
th {
background-color: #f8f9fa;
color: #555;
}
tr:hover {
background-color: #fafafa;
}
/* Link e messaggi */
a {
color: #007bff;
text-decoration: none;
font-size: 14px;
}
a:hover {
text-decoration: underline;
}
.msg {
padding: 10px;
margin-bottom: 15px;
border-radius: 5px;
text-align: center;
font-size: 14px;
}
.error {
background: #f8d7da;
color: #721c24;
border: 1px solid #f5c6cb;
}
.success {
background: #d4edda;
color: #155724;
border: 1px solid #c3e6cb;
}
</style>
</head>
<?php
session_start();
require '_db_config.php';
// Se la sessione non è attiva, torna al login
if (!isset($_SESSION['loggato'])) {
header("Location: login.php");
exit;
}
// Query semplice (senza parametri esterni non serve il prepared statement)
$sql = "SELECT username, email FROM utente";
$query_risultato = mysqli_query($conn, $sql);
?>
<h2>Benvenuto, <?php echo htmlspecialchars($_SESSION['utente']); ?></h2>
<a href="logout.php">Disconnetti</a>
<table border="1" style="width:100%; margin-top:20px; text-align:left;">
<tr>
<th>Username</th>
<th>Email</th>
</tr>
<?php while ($riga = mysqli_fetch_assoc($query_risultato)): ?>
<tr>
<td><?php echo htmlspecialchars($riga['username']); ?></td>
<td><?php echo htmlspecialchars($riga['email']); ?></td>
</tr>
<?php endwhile; ?>
</table>