<?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">
<!--
function LimitaCheck (cc, max) {
conta = 0;
var cc1 = cc.form;
for(var i=0; i<cc1.length; i++) {
if(cc1[i].type=='checkbox' && cc1[i].checked) {
conta++;
}
}
return (conta<=max);
}
function controllaEmail (messaggio) {
var email = document.form_votazione.email.value;
var email_reg_exp = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
if (!email_reg_exp.test(email) || (email == "") || (email == "undefined")) {
alert(messaggio);
document.form_votazione.email.select();
return false;
}
}
//-->
</script>
<title>PHPOLL</title>
<link rel="stylesheet" href="css/phpoll_layout.css" title="phpoll layout" />
</head>
<body>
<?php
include "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_band = "SELECT * FROM ".$tab_band." ORDER BY nome_band;";
$estrai_band = mysql_query($query_band, $phpoll_db)
or die ("Errore nella connessione per estrazione band al database ".$phpoll_database);
print "<div class=\"votazione\">";
print "<form action=\"cookies/elabora_voto_mail.php\" method=\"post\" name=\"form_votazione\">";
print "<table>";
$i=0;
while ($dati_band=mysql_fetch_assoc ($estrai_band)) {
print "<tr>";
print "<td>";
print "<input type=\"checkbox\" onClick=\"return LimitaCheck (this, ".$massimo_numero_checkbox.");\" name=\"nome_band_check_".$i."\">".$dati_band['nome_band']."</input>";
print "</td>";
print "</tr>";
print "<input type=\"hidden\" name=\"id_".$i."\" value=\"".$dati_band['id']."\" />";
print "<input type=\"hidden\" name=\"nome_band_".$i."\" value=\"".$dati_band['nome_band']."\" />";
$i++;
}
print "</table>";
print "<p> ".$valid_email."</p>";
print "<table>";
print "<tr>";
print "<td>";
print "<input type=\"text\" name=\"email\" size=\"20\" />";
print "</td>";
print "<td>";
print "<input type=\"submit\" name=\"submit_voto\" onClick=\"return controllaEmail('".$valid_email."');\" value=\"".$testo_submit."\" />";
print "</td>";
print "</tr>";
print "</table>";
print "</form>";
print "</div>";
mysql_close ($phpoll_db);
?>
</body>
</html>