<?php
if(!isset($_SESSION)){session_start ();}
require('config.php');
if(!isset($_SESSION['login']))
{
header('Location: index.php');
exit;
}
    $default = mysql_fetch_array(mysql_query("SELECT cognome_utente, nome_utente FROM utenti WHERE id = '{$_SESSION['login']}' LIMIT 1"));
?>
<?php 
$db_host = '';
$db_utente = '';
$db_password = '';
$db_nomedb = '';
$dbh=mysql_connect ($db_host, $db_utente, $db_password) or die ('Errore nella stringa di connessione al database: '.mysql_error());
mysql_select_db($db_nomedb);
?>
<?php 
$query=mysql_query("SELECT cognome_utente, nome_utente FROM utenti ORDER BY tot");
$utenti=mysql_num_rows($query);
echo "<table>";  
//non devi usare l'array globale $_post 
while($utenti=mysql_fetch_array($query)){  
  
$cognome_utente=$utenti['cognome_utente'];  
$nome_utente=$utenti['nome_utente'];  
$tot=$utenti['tot'];
$tot = ($punteggio == 1) ? "$punteggio punto" : "$punteggio punti";
$punteggio=$_SESSION['punteggio'];  
echo "<tr> 
    
    <td>$cognome_utente</td> 
    <td>$nome_utente</td> 
     <td>Hai totalizzato $tot</td>
    
    </tr>";  
} //fine del while 
echo "</table><br><br>";   
?>