73 lines
1.4 KiB
PHP
73 lines
1.4 KiB
PHP
<?php
|
|
// Controlla se qualcuno è loggato lmao
|
|
use services\Access;
|
|
|
|
require_once('services/Access.php');
|
|
|
|
session_start();
|
|
$username = null;
|
|
$password = null;
|
|
if (isset($_SESSION['username'])) {
|
|
$username = $_SESSION['username'];
|
|
}
|
|
if (isset($_SESSION['password'])) {
|
|
$password = $_SESSION['password'];
|
|
}
|
|
|
|
$loginResult = Access::login($username, $password);
|
|
|
|
if (!$username || !$password || !$loginResult || !$loginResult->num_rows == 1) {
|
|
header('Location: http://localhost:8080/form.php/');
|
|
}
|
|
|
|
|
|
?>
|
|
<head>
|
|
<style>
|
|
body {
|
|
font-family: "FreeSans";
|
|
padding: 20px;
|
|
}
|
|
|
|
table {
|
|
width: 600px;
|
|
border-spacing: 0;
|
|
}
|
|
|
|
th {
|
|
border: 1px solid black;
|
|
padding: 15px;
|
|
}
|
|
|
|
</style>
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<h1> Tabella Utenti </h1>
|
|
<?php
|
|
|
|
|
|
global $conn;
|
|
include "config/database-connection.php";
|
|
|
|
$query = "SELECT * FROM users";
|
|
$result = mysqli_query($conn, $query);
|
|
|
|
echo "<table>";
|
|
echo "<tr> <th> ID </th> <th> DESCRIZIONE </th> <th> DATA_CREAZIONE </th> <th>ID_PERSONA </th> </tr>";
|
|
while ($row = mysqli_fetch_assoc($result)) {
|
|
echo "<tr>" .
|
|
"<th>" . $row["ID"] . "</th>" .
|
|
"<th>" . $row["DESCRIZIONE"] . "</th>" .
|
|
"<th>" . $row["DATA_CREAZIONE"] . "</th>" .
|
|
"<th>" . $row["ID_PERSONA"] . "</th>" .
|
|
" </tr>";
|
|
}
|
|
echo "</table>";
|
|
?>
|
|
</body>
|
|
|
|
|
|
|