Location: PHPKode > projects > PHPOLL php - mysql poll system > phpoll_files/admin/config_editor.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" src="ColorPicker2.js"></script>
<script type="text/javascript" src="AnchorPosition.js"></script>
<script type="text/javascript" src="PopupWindow.js"></script>

<script type="text/javascript" language="JavaScript">
<!--

var cp = new ColorPicker('window'); // Popup window

function submitForm () {
	
	var answer = confirm ("<?php print $config_alert_conferma; ?>");
  
		if (answer) {
			window.document.modifica_configurazione.submit();
		}
		else {
			alert ("<?php print $config_alert_annulla; ?>");
		}
		
}



// -->
</script>

<title>PHPOLL - configurazione</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 class=\"attuale\" href=\"config_editor.php\">".$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 href=\"risultati_config.php?language=".$language."\">".$admin_menu_risultati."</a>";

?>

</div>

<div class="forms">

<?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_config = "SELECT * FROM phpoll_".$prepoll."_configurazione;";

$estrai_config = mysql_query($query_config, $phpoll_db)
	or die ("Errore nella connessione per estrazione configurazione dal database ".$phpoll_database);

// QUERY per MySQL
$query_login = "SELECT login, password FROM phpoll_".$prepoll."_configurazione;";	
	
$estrai_login = mysql_query($query_login, $phpoll_db)
	or die ("Errore nella connessione per estrazione login configurazione dal database ".$phpoll_database);
	
$string_cook_login = "phpoll_".$prepoll."_login";
$string_cook_password = "phpoll_".$prepoll."_password";	
	
while ($dati_login=mysql_fetch_assoc ($estrai_login)) {
	
	$log=$dati_login['login'];
	$pw=$dati_login['password'];
	
	if ($log!="admin"&&$pw!="admin") {

	if ((isset($_COOKIE[$string_cook_login])&&$log==$_COOKIE[$string_cook_login])&&(isset($_COOKIE[$string_cook_password])&&$pw==$_COOKIE[$string_cook_password])) {
		
		$test_log = true;
		
	}
	
	else {
		
		$test_log = false;
		
	}
	
	}
	
	else {
		
		$test_log = true;
		
	}	

}

if ($test_log) {
	
print "<div class=\"votanti\">";	

print "<form onSubmit=\"return cancella();\" action=\"modifica_configurazione.php?language=".$language."\" method=\"post\" name=\"modifica_configurazione\">";

print "<table border=\"1\">";

$sizex = 110;

while ($dati_config=mysql_fetch_assoc ($estrai_config)) {
	
	print "<tr>";
		print "<td id=\"votanti_titoli\">".$config_posizione."</td>";	
		print "<td colspan=\"3\">";
			print "<input type=\"text\" size=\"".$sizex."\" name=\"titolo_posizione\" value=\"".$dati_config['titolo_posizione']."\" />";
		print "</td>";
	print "</tr>";
	
	print "<tr>";
		print "<td id=\"votanti_titoli\">".$config_tipologia."</td>";
		print "<td colspan=\"3\">";
			print "<input type=\"text\" size=\"".$sizex."\" name=\"titolo_tipologia\" value=\"".$dati_config['titolo_tipologia']."\" />";
		print "</td>";
	print "</tr>";
	
	print "<tr>";	
		print "<td id=\"votanti_titoli\">".$config_punteggio."</td>";
		print "<td colspan=\"3\">";
			print "<input type=\"text\" size=\"".$sizex."\" name=\"titolo_punteggio\" value=\"".$dati_config['titolo_punteggio']."\" />";
		print "</td>";
	print "</tr>";
	
	print "<tr>";
		print "<td id=\"votanti_titoli\">".$config_maxvoti."</td>";
		print "<td colspan=\"3\">";
			print "<input type=\"text\" size=\"".$sizex."\" name=\"max_voti\" value=\"".$dati_config['max_voti']."\" />";
		print "</td>";
	print "</tr>";
	
	print "<tr>";
		print "<td id=\"votanti_titoli\">".$config_maxpixelgraficorisultati."</td>";		
		print "<td colspan=\"3\">";
			print "<input type=\"text\" size=\"".$sizex."\" name=\"risultati_pixel\" value=\"".$dati_config['risultati_pixel']."\" />";
		print "</td>";	
	print "</tr>";
	
	print "<tr>";
		print "<td id=\"votanti_titoli\">".$config_primocolore."</td>";
		print "<td>";
		
		if ($dati_config['barra1r']<=15) {
			$add1="0";
		}
		if ($dati_config['barra1g']<=15) {
			$add2="0";
		}
		if ($dati_config['barra1b']<=15) {
			$add3="0";
		}
		
		$barra1="#".$add1.strtoupper(dechex($dati_config['barra1r'])).$add2.strtoupper(dechex($dati_config['barra1g'])).$add3.strtoupper(dechex($dati_config['barra1b']));
		
			print "<input type=\"text\" name=\"barra1\" id=\"barra1\" size=\"20\" value=\"".$barra1."\" />";
			print "<a href=\"#\" onClick=\"cp.select(document.forms[1].barra1,'pick1'); return false;\" name=\"pick1\" id=\"pick1\">".$config_sceglicolore."</a>";
		
		//	print "<input type=\"text\" size=\"5\" name=\"barra1r\" value=\"".$dati_config['barra1r']."\" />";
		print "</td>";
		
		//print "<td>";
		//	print "<input type=\"text\" size=\"5\" name=\"barra1g\" value=\"".$dati_config['barra1g']."\" />";
		//print "</td>";


		//print "<td>";
		//	print "<input type=\"text\" size=\"5\" name=\"barra1b\" value=\"".$dati_config['barra1b']."\" />";
		//print "</td>";
	print "</tr>";
	
	print "<tr>";
		print "<td id=\"votanti_titoli\">".$config_secondocolore."</td>";
		
		print "<td>";
		
		if ($dati_config['barra2r']<=15) {
			$add21="0";
		}
		if ($dati_config['barra2g']<=15) {
			$add22="0";
		}
		if ($dati_config['barra2b']<=15) {
			$add23="0";
		}
		
		$barra2="#".$add21.strtoupper(dechex($dati_config['barra2r'])).$add22.strtoupper(dechex($dati_config['barra2g'])).$add23.strtoupper(dechex($dati_config['barra2b']));
		
			print "<input type=\"text\" name=\"barra2\" id=\"barra2\" size=\"20\" value=\"".$barra2."\" />";
			print "<a href=\"#\" onClick=\"cp.select(document.forms[1].barra2,'pick2'); return false;\" name=\"pick2\" id=\"pick2\">".$config_sceglicolore."</a>";
		
		print "</td>";
/*		
		print "<td>";
			print "<input type=\"text\" size=\"5\" name=\"barra2r\" value=\"".$dati_config['barra2r']."\" />";
		print "</td>";
		print "<td>";
			print "<input type=\"text\" size=\"5\" name=\"barra2g\" value=\"".$dati_config['barra2g']."\" />";
		print "</td>";
		print "<td>";
			print "<input type=\"text\" size=\"5\" name=\"barra2b\" value=\"".$dati_config['barra2b']."\" />";
		print "</td>";*/
	print "</tr>";
	
	print "<tr>";
		print "<td id=\"votanti_titoli\">".$config_terzocolore."</td>";
		
		print "<td>";
		
		if ($dati_config['barra3r']<=15) {
			$add31="0";
		}
		if ($dati_config['barra3g']<=15) {
			$add32="0";
		}
		if ($dati_config['barra3b']<=15) {
			$add33="0";
		}
		
		$barra3="#".$add31.strtoupper(dechex($dati_config['barra3r'])).$add32.strtoupper(dechex($dati_config['barra3g'])).$add33.strtoupper(dechex($dati_config['barra3b']));
		
			print "<input type=\"text\" name=\"barra3\" id=\"barra3\" size=\"20\" value=\"".$barra3."\" />";
			print "<a href=\"#\" onClick=\"cp.select(document.forms[1].barra3,'pick3'); return false;\" name=\"pick3\" id=\"pick3\">".$config_sceglicolore."</a>";
		
		print "</td>";
	/*	
		print "<td>";
			print "<input type=\"text\" size=\"5\" name=\"barra3r\" value=\"".$dati_config['barra3r']."\" />";
		print "</td>";
		print "<td>";
			print "<input type=\"text\" size=\"5\" name=\"barra3g\" value=\"".$dati_config['barra3g']."\" />";
		print "</td>";
		print "<td>";
			print "<input type=\"text\" size=\"5\" name=\"barra3b\" value=\"".$dati_config['barra3b']."\" />";
		print "</td>";*/
	print "</tr>";
	
	print "<tr>";
		print "<td id=\"votanti_titoli\">".$config_quartocolore."</td>";
		
		print "<td>";
		
		if ($dati_config['barra4r']<=15) {
			$add41="0";
		}
		if ($dati_config['barra4g']<=15) {
			$add42="0";
		}
		if ($dati_config['barra4b']<=15) {
			$add43="0";
		}
		
		$barra4="#".$add41.strtoupper(dechex($dati_config['barra4r'])).$add42.strtoupper(dechex($dati_config['barra4g'])).$add43.strtoupper(dechex($dati_config['barra4b']));
		
		
			print "<input type=\"text\" name=\"barra4\" id=\"barra4\" size=\"20\" value=\"".$barra4."\" />";
			print "<a href=\"#\" onClick=\"cp.select(document.forms[1].barra4,'pick2'); return false;\" name=\"pick4\" id=\"pick4\">".$config_sceglicolore."</a>";
		
		print "</td>";
/*		
		print "<td>";
			print "<input type=\"text\" size=\"5\" name=\"barra4r\" value=\"".$dati_config['barra4r']."\" />";
		print "</td>";
		print "<td>";
			print "<input type=\"text\" size=\"5\" name=\"barra4g\" value=\"".$dati_config['barra4g']."\" />";
		print "</td>";
		print "<td>";
			print "<input type=\"text\" size=\"5\" name=\"barra4b\" value=\"".$dati_config['barra4b']."\" />";
		print "</td>";*/
	print "</tr>";
	
	print "<tr>";
		print "<td id=\"votanti_titoli\">".$config_tempoip."</td>";
		print "<td colspan=\"3\">";
			print "<input type=\"text\" size=\"".$sizex."\" name=\"intervallo_tempo\" value=\"".$dati_config['intervallo_tempo']."\" />";
		print "</td>";
	print "</tr>";
	
	print "<tr>";
		print "<td id=\"votanti_titoli\">".$config_percorsoassoluto."</td>";
		print "<td colspan=\"3\">";
			print "<input type=\"text\" size=\"".$sizex."\" name=\"percorso_link\" value=\"".$dati_config['percorso_link']."\" />";
		print "</td>";
	print "</tr>";
	
	print "<tr>";
		print "<td id=\"votanti_titoli\">".$config_oggettoemail."</td>";
		print "<td colspan=\"3\">";
			print "<input type=\"text\" size=\"".$sizex."\" name=\"oggetto_email\" value=\"".$dati_config['oggetto_email']."\" />";
		print "</td>";
	print "</tr>";
	
	print "<tr>";
		print "<td id=\"votanti_titoli\">".$config_testoemail."</td>";
		print "<td colspan=\"3\">";
			print "<textarea cols=\"75\" rows=\"3\" id=\"TestoAreaEmail\" name=\"testo_email\">".$dati_config['testo_email']."</textarea>";
		print "</td>";
	print "</tr>";
	
	print "<tr>";
		print "<td id=\"votanti_titoli\">".$config_dominiesclusi."</td>";
		print "<td colspan=\"3\">";
			print "<input type=\"text\" size=\"".$sizex."\" name=\"domini\" value=\"".$dati_config['domini']."\" />";
		print "</td>";
	print "</tr>";
	
	print "<tr>";
		print "<td id=\"votanti_titoli\">".$config_testosubmit."</td>";
		print "<td colspan=\"3\">";
			print "<input type=\"text\" size=\"".$sizex."\" name=\"testo_submit\" value=\"".$dati_config['testo_submit']."\" />";
		print "</td>";
	print "</tr>";
	
	print "<tr>";
		print "<td id=\"votanti_titoli\">".$config_messaggioemailvalido."</td>";
		print "<td colspan=\"3\">";
			print "<input type=\"text\" size=\"".$sizex."\" name=\"valid_email\" value=\"".$dati_config['valid_email']."\" />";
		print "</td>";
	print "</tr>";
	
	print "<tr>";
		print "<td id=\"votanti_titoli\">".$config_messaggiomailinviata."</td>";
		print "<td colspan=\"3\">";
			print "<input type=\"text\" size=\"".$sizex."\" name=\"messaggio_conferma_mail\" value=\"".$dati_config['messaggio_conferma_mail']."\" />";
		print "</td>";
	print "</tr>";
	
	print "<tr>";
		print "<td id=\"votanti_titoli\">".$config_messaggioerroredominiesclusi."</td>";
		print "<td colspan=\"3\">";
			print "<input type=\"text\" size=\"".$sizex."\" name=\"messaggio_domini\" value=\"".$dati_config['messaggio_domini']."\" />";
		print "</td>";
	print "</tr>";
	
	print "<tr>";
		print "<td id=\"votanti_titoli\">".$config_messaggioerrorevotatostessoip."</td>";
		print "<td colspan=\"3\">";
			print "<input type=\"text\" size=\"".$sizex."\" name=\"messaggio_ip\" value=\"".$dati_config['messaggio_ip']."\" />";
		print "</td>";
	print "</tr>";
	
	print "<tr>";
		print "<td id=\"votanti_titoli\">".$config_messaggioerrorevotato."</td>";
		print "<td colspan=\"3\">";
			print "<input type=\"text\" size=\"".$sizex."\" name=\"messaggio_giavotato\" value=\"".$dati_config['messaggio_giavotato']."\" />";
		print "</td>";
	print "</tr>";
	
	print "<tr>";
		print "<td id=\"votanti_titoli\">".$config_messaggioerroresgamo."</td>";
		print "<td colspan=\"3\">";
			print "<input type=\"text\" size=\"".$sizex."\" name=\"messaggio_sgamo\" value=\"".$dati_config['messaggio_sgamo']."\" />";
		print "</td>";
	print "</tr>";
	

	
	print "<tr>";
		print "<td id=\"votanti_titoli\">".$config_login."</td>";		
		print "<td colspan=\"3\">";
			print "<input type=\"text\" size=\"40\" name=\"login\" value=\"".$log."\" />";
		print "</td>";	
	print "</tr>";
	
	print "<tr>";
		print "<td id=\"votanti_titoli\">".$config_password."</td>";		
		print "<td colspan=\"3\">";
			print "<input type=\"text\" size=\"40\" name=\"password\" value=\"".$pw."\" />";
		print "</td>";	
	print "</tr>";
	
	print "<input type=\"hidden\" name=\"old_login\" value=\"".$log."\" />";
	print "<input type=\"hidden\" name=\"old_password\" value=\"".$pw."\" />";	

}

print "</table>";

print "<a href=\"#\" onClick=\"submitForm();\"><img src=\"../img/disk.gif\" alt=\"".$config_salvamodifiche."\" /> ".$config_salvamodifiche."</a>";
//print "<input type=\"submit\" name=\"submit\" value=\"conferma modifica\" />";
print "</form>";

print "</div>";

}

else {
	
	print "<form action=\"elabora_cookie.php\" method=\"post\" name=\"form_elabora\">";
	print "<table align=\"center\">";
	print "<tr>";
	print "<td>login</td>";
	print "<td>";
	print "<input type=\"text\" name=\"log\" size=\"30\" />";
	print "</td>";
	print"</tr><tr>";
	print "<td>password</td>";
	print "<td>";
	print "<input type=\"password\" name=\"pw\" size=\"30\" />";
	print "</td>";
	print "</tr></table>";
	print "<input type=\"submit\" name=\"submit\" value=\"".$config_conferma."\" />";
	print "</form>";
		
	
}

mysql_close ($phpoll_db);


?>


</div>
</div>

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