Ho solo modificato le parti inerenti a ciò che chiedi, senza badare al resto e senza testare...Prova:Salve!
Come faccio? Mi ci sto scervellando da un po' senza venirne a capo.. mi sono venute tante idee ma nessuna ha risolto il mio problema.
PHP:
<?php
require_once('../includes/config.php');
session_start();
if (isset ($_SESSION['logged'])) {
if ($_SESSION['user_level'] == 1 && $_SESSION['logged'] == 1){
?>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=800;height=700">
<link rel="stylesheet" href="./../style.css" />
</head>
<body>
<div class="content">
<h3>Pannello di controllo</h3>
<br />
<nav class='menu'>
<p>Benvenuto <strong><?php echo $_SESSION['username'] ?></strong>.</p>
<a href='./create_user.php'>Crea Utente</a>
<a href='./../logout.php'>Esci</a>
</nav>
<br />
<?php
$sql = "SELECT *
FROM utenti
ORDER BY userid ASC
";
$result = mysql_query($sql) or die ("Qualcosa è andato storto." . mysql_error());
echo "
";
echo '
<table>
<th>Id</th>
<th>Username</th>
<th>Password</th>
<th>Last log</th>
<th>Tipo di utente</th>
<th>Azioni</th>
';
while ($row = mysql_fetch_assoc($result)) {
//Info
echo "<tr>";
echo "<td>" . $row["userid"] . "</td>" .
"<td>" . $row["username"] . "</td>" .
"<td>" . $row["password"] . "</td>" .
"<td>" . date('d-m-Y',$row["lastlog"]) . "</td>" .
"<td>" .
switch ($row["user_level"]) {
case 0:
"User";
break;
case 1:
"Admin";
break;
}
. "</td>" .
//Azioni
"<td>" . '<a href="./update_user.php?id=' . $row['userid'] . '&username='. $row['username'] .'&user_level='. $row['user_level'] . '">Modifica Utente</a>' . " " .
'<a href="./delete_user.php?id='. $row['userid'] .' &username= '. $row['username'] .'">Elimina Utente</a>' . "</td>" ;
echo "</tr>";
}
echo '</table>';
}else {
echo "<p>Non sei autorizzato ad accedere a questa pagina.</p>";
}
}else{
header ('Location: ./../login.php');
}
?>