<?php echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?".">";
/*
This file is part of PHPOLL.
PHPOLL is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
PHPOLL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with PHPOLL; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript" language="JavaScript">
</script>
<title>PHPOLL - risultati</title>
<link rel="stylesheet" href="contest2007/css/phpoll_layout.css" title="phpoll layout" />
</head>
<body>
<?php
include "contest2007/config/config.php";
// assegno le variabili di connessione
$phpoll_db = mysql_connect ($phpoll_host, $phpoll_user, $phpoll_password)
or die ("Errore nella connessione a MySQL");
// selezione del database
mysql_select_db($phpoll_database, $phpoll_db)
or die ("Errore nella connessione al database ".$phpoll_database);
// QUERY per MySQL
$query_band0 = "SELECT * FROM ".$tab_band.";";
$estrai_band0 = mysql_query($query_band0, $phpoll_db)
or die ("Errore nella connessione per estrazione band al database ".$database);
while ($dati_band0=mysql_fetch_assoc ($estrai_band0)) {
$totale=$totale+$dati_band0['voti'];
}
print "totale voti = ".$totale;
// QUERY per MySQL
$query_band = "SELECT * FROM ".$tab_band." ORDER BY voti DESC;";
$estrai_band = mysql_query($query_band, $phpoll_db)
or die ("Errore nella connessione per estrazione band al database ".$database);
print "<div class=\"risultati\">";
print "<table border=1 frame=box rules=all>";
print "<tr id=\"risultati_titoli\">";
print "<td>".$titolo_posizione."</td>"; // settare in configurazione i nomi
print "<td>".$titolo_tipologia."</td>";
print "<td colspan=\"2\">".$titolo_punteggio."</td>";
print "</tr>";
$i=1;
$ii=1;
while ($dati_band=mysql_fetch_assoc ($estrai_band)) {
if ($i==1) {
$divisore = ($dati_band['voti']/$risultati_pixel);
}
$dimensione_x = ($dati_band['voti']/$divisore);
if ($i==1) {
$colore = "1";
}
else if ($i>1&&$i<=5) {
$colore = "2";
}
else if ($i>5&&$i<=10) {
$colore = "3";
}
else {
$colore = "4";
}
print "<tr>";
print "<td>";
print $ii;
print "</td>";
print "<td>";
print $dati_band['nome_band'];
print "</td>";
print "<td>";
print "<img src=\"img/barra".$colore.".gif\" height=\"10\" width=\"".$dimensione_x."\" alt=\"".$titolo_punteggio." = ".$dati_band['voti']."\" title=\"".$titolo_punteggio." = ".$dati_band['voti']."\" />";
print "</td>";
print "<td>".$dati_band['voti']."</td>";
$percentuale=($dati_band['voti']/$totale)*100;
$percentuale_formattata = number_format($percentuale, 2, ',', '.');
print "<td>".$percentuale_formattata." %";
print "</tr>";
$i++;
$ii++;
}
print "</table>";
print "</div>";
mysql_close ($phpoll_db);
?>
</body>
</html>