Location: PHPKode > projects > PHPOLL php - mysql poll system > phpoll_files/admin/risultati_config.php
<!--

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

-->

<?php

if (isset ($_GET['language'])) { 
	$language=(int)$_GET['language'];
}

else {
	$language=1;
}

if ($language==0) {

  die ("Try a different way!");

}

include "../config/config.php";
include "localization.php";

?>

<!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="../css/phpoll_layout.css" title="phpoll layout" />
</head>

<body>

<div class="corpo">

<img src="../img/poll_logo.jpg" alt="phpoll logo" />
<img src="../main_img/phpoll_char.gif" alt="phpoll" />

<br />

<a href="config_editor.php?language=1"><img src="../img/ita.jpg" alt="italiano" /></a>
<a href="config_editor.php?language=2"><img src="../img/eng.jpg" alt="english" /></a>

<br />

<?php

print "<div class=\"titolo_db\">";
print "POLL: ".$prepoll;
print "&nbsp;&nbsp;&nbsp;IP: ".$_SERVER['REMOTE_ADDR'];
print "</div>";

?>

<div class="menu">

<?php 

print "<a href=\"config_editor.php?language=".$language."\">".$admin_menu_config."</a>";
print "<a href=\"band_editor.php?language=".$language."\">".$admin_menu_candidati."</a>";
print "<a href=\"votanti.php?language=".$language."\">".$admin_menu_voti."</a>";
print "<a class=\"attuale\" href=\"risultati_config.php\">".$admin_menu_risultati."</a>";

?>

</div>

<?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_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 ".$phpoll_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);
	}
	
	if ($divisore>0) {
	
	 $dimensione_x = ($dati_band['voti']/$divisore);
	}
	else {
  $dimensione_x=1;
  }
    
  switch ($i) {
	  
	case $i=1: $colore = "1";
			   break;
    case $i=2: $colore = "2";
    		   break;
    case $i=3: $colore = "3";
    		   break;
    case $i=4: $colore = "4";
    		   break;
    		   
  }	
 
/*
  	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>";
	print "</tr>";
	
	$i++;
	$ii++;

}

print "</table>";

print "</div>";

mysql_close ($phpoll_db);


?>

</div>

</body>
</html>
Return current item: PHPOLL php - mysql poll system