"; print_r($dadesUsuariIdentificat); echo "";*/ ?>
0) { $SQL=" CREATE TABLE IF NOT EXISTS `enderrock_formpremisbalears".intval($_GET['creaTaulaAny'])."` ( `ID` int(11) NOT NULL auto_increment, `camp1` text NOT NULL, `camp2` text NOT NULL, `camp3` text NOT NULL, `camp4` text NOT NULL, `camp5` text NOT NULL, `camp6` text NOT NULL, `camp7` text NOT NULL, `camp8` text NOT NULL, `camp9` text NOT NULL, `camp10` text NOT NULL, `camp11` text NOT NULL, `camp12` text NOT NULL, `camp13` text NOT NULL, `camp14` text NOT NULL, `camp15` text NOT NULL, `camp16` text NOT NULL, `camp17` text NOT NULL, `camp18` text NOT NULL, `camp19` text NOT NULL, `camp20` text NOT NULL, `camp21` text NOT NULL, `camp22` text NOT NULL, `camp23` text NOT NULL, `camp24` text NOT NULL, `camp25` text NOT NULL, `camp26` text NOT NULL, `camp27` text NOT NULL, `camp28` text NOT NULL, `camp29` text NOT NULL, `camp30` text NOT NULL, `camp31` text NOT NULL, `camp32` text NOT NULL, `camp33` text NOT NULL, `camp34` text NOT NULL, `camp35` text NOT NULL, `camp36` text NOT NULL, `camp37` text NOT NULL, `camp38` text NOT NULL, `camp39` text NOT NULL, `camp40` text NOT NULL, `camp41` text NOT NULL, `camp42` text NOT NULL, `camp43` text NOT NULL, `camp44` text NOT NULL, `camp45` text NOT NULL, `camp46` text NOT NULL, `camp47` text NOT NULL, `camp48` text NOT NULL, `camp49` text NOT NULL, `camp50` text NOT NULL, `camp51` text NOT NULL, `camp52` text NOT NULL, `camp53` text NOT NULL, `camp54` text NOT NULL, `camp55` text NOT NULL, `camp56` text NOT NULL, `camp57` text NOT NULL, `camp58` text NOT NULL, `camp59` text NOT NULL, `camp60` text NOT NULL, `camp61` text NOT NULL, `camp62` text NOT NULL, `camp63` text NOT NULL, `camp64` text NOT NULL, `camp65` text NOT NULL, `camp66` text NOT NULL, `camp67` text NOT NULL, `camp68` text NOT NULL, `camp69` text NOT NULL, `camp70` text NOT NULL, `camp71` text NOT NULL, `camp72` text NOT NULL, `camp73` text NOT NULL, `camp74` text NOT NULL, `camp75` text NOT NULL, `camp76` text NOT NULL, `camp77` text NOT NULL, `camp78` text NOT NULL, `camp79` text NOT NULL, `camp80` text NOT NULL, `camp81` text NOT NULL, `camp82` text NOT NULL, `camp83` text NOT NULL, `camp84` text NOT NULL, `camp85` text NOT NULL, `camp86` text NOT NULL, `camp87` text NOT NULL, `camp88` text NOT NULL, `camp89` text NOT NULL, `camp90` text NOT NULL, `camp91` text NOT NULL, `camp92` text NOT NULL, `camp93` text NOT NULL, `camp94` text NOT NULL, `camp95` text NOT NULL, `camp96` text NOT NULL, `camp97` text NOT NULL, `camp98` text NOT NULL, `camp99` text NOT NULL, `camp100` text NOT NULL, `IDusuari` int(11) NOT NULL, `fecha` int(11) NOT NULL, `volta` int(11) NOT NULL, PRIMARY KEY (`ID`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1;"; @bbdd_query($SQL); echo "Taula creada correctament
"; } include("includes/configPremis/configbalears2022.php"); $ara=time(); $pv1i=explode(" ",$iniciVolta1); $pfv1i=explode("/",$pv1i[0]); $phv1i=explode(":",$pv1i[1]); $pv1f=explode(" ",$fiVolta1); $pfv1f=explode("/",$pv1f[0]); $phv1f=explode(":",$pv1f[1]); $pv2i=explode(" ",$iniciVolta2); $pfv2i=explode("/",$pv2i[0]); $phv2i=explode(":",$pv2i[1]); $pv2f=explode(" ",$fiVolta2); $pfv2f=explode("/",$pv2f[0]); $phv2f=explode(":",$pv2f[1]); $pv3i=explode(" ",$iniciVolta3); $pfv3i=explode("/",$pv3i[0]); $phv3i=explode(":",$pv3i[1]); /*$pv3f=explode(" ",$fiVolta3); $pfv3f=explode("/",$pv3f[0]); $phv3f=explode(":",$pv3f[1]);*/ $dataIniVolta1=mktime($phv1i[0],$phv1i[1],0,$pfv1i[1],$pfv1i[0],$pfv1i[2]); $dataFinVolta1=mktime($phv1f[0],$phv1f[1],0,$pfv1f[1],$pfv1f[0],$pfv1f[2]); $dataIniVolta2=mktime($phv2i[0],$phv2i[1],0,$pfv2i[1],$pfv2i[0],$pfv2i[2]); $dataFinVolta2=mktime($phv2f[0],$phv2f[1],0,$pfv2f[1],$pfv2f[0],$pfv2f[2]); /*$dataIniVolta3=mktime($phv3i[0],$phv3i[1],0,$pfv3i[1],$pfv3i[0],$pfv3i[2]); $dataFinVolta3=mktime($phv3f[0],$phv3f[1],0,$pfv3f[1],$pfv3f[0],$pfv3f[2]);*/ $anycurt=substr($any,2,2); if ($previewPremis==1) { $ara=$dataIniVolta1+5; } /*if ($_GET['test']==1) { $ara=mktime(12,0,0,2,26,2013); } */ ?>
=$dataFinVolta1 && $ara<$dataIniVolta2) { echo "

1a ronda de votacions

"; echo "
Ha acabat la 1a ronda de votacions dels Premis de la música balear $any
"; echo "El ".$pv2i[0]." s'obrirà la 2a ronda de votacions, que finalitzarà el ".$pv2f[0]."
"; /*} elseif ($ara>=$dataFinVolta2 && $ara<$dataIniVolta3) { echo "

2a ronda de votacions

"; echo "
Ha acabat la 2a ronda de votacions dels Premis de la música balear $any
"; echo "El ".$pv3i[0]." s'obrirà la 3a ronda de votacions, que finalitzarà el ".$pv3f[0]."
";*/ } elseif ($ara>=$dataFinVolta2) { echo "
El període de votacions ha finalitzat
"; } elseif ($ara<$dataIniVolta1) { echo "
El període de votacions s'obrirà el proper ".$pv1i[0]."
"; } else { echo "

".$voltaVotacions."a ronda de votacions

"; $taulaPremis=$propietatsdiari['tag']."_formpremisbalears$anycurt"; $noMostris=0; if ($idusuario==0) { $noMostris=1; //$fraseErr="
Cal que us registreu per realitzar la vostra votació.

Accediu al formulari de registre o accediu amb el vostre usuari i clau
"; $fraseErr="
Cal que us registreu per realitzar la vostra votació.

Accediu al formulari de registre o accediu amb el vostre usuari i clau
"; } else { $SQL="SELECT * FROM ".$propietatsdiari['tag']."_usuaris WHERE ID=".$idusuario; $res=@bbdd_query($SQL); $row=@bbdd_fetch_assoc($res); /*if (intval($row['validat'])==0) { $noMostris=1; $fraseErr="

Cal que confirmeu l'alta amb el correu electrònic que heu rebut al registrar-vos per poder fer la vostra votació.

"; } else {*/ $SQL2="SELECT * FROM $taulaPremis WHERE IDusuari=".$idusuario." AND volta=".$voltaVotacions; $res2=@bbdd_query($SQL2); if (@bbdd_num_rows($res2)>0) { $noMostris=1; $fraseErr="
Ja heu enviat la vostra votació anteriorment i no podeu tornar a votar en aquesta volta.
"; } //} } if ($noMostris==1) { echo "
".$fraseErr."
"; } function posainputpremis($camp,$i,$opcions="",$defVal="") { if ($camp=="text") { $retVal=""; } elseif ($camp == "select") { $retVal=""; } return $retVal; } function posalabelpremis($label,$i) { $retVal=""; return $retVal; } function posacamppremis($label,$camp,$i,$opcions="",$defvalara="") { /*global $valorDefault; if (isset($valorsDefault[$label])) { $defvalara=$valorsDefault[strip_tags($label)]; } else { $defvalara=""; } */ $label=posalabelpremis($label,$i); $input=posainputpremis($camp,$i,$opcions,$defvalara); return "
".$label." ".$input."
"; } $valorsDefault['Nom i cognoms']=stripslashes($dadesusuari['nom']." ".$dadesusuari['cognoms']); $valorsDefault['Població']=stripslashes($dadesusuari['ciutat']); $valorsDefault['Telèfon']=stripslashes($dadesusuari['tlf']); $valorsDefault['Correu electrònic']=stripslashes($dadesusuari['mail']); function posafieldsetpremis($titol,$arrCamps) { global $opcions,$htmlPropi,$valorDefault; $retVal=""; $retVal.="
$titol"; foreach ($arrCamps as $k=>$v) { foreach ($v as $k2=>$v2) { if (isset($htmlPropi[$titol][$k]['prehtml'])) { $retVal.=$htmlPropi[$titol][$k]['prehtml']; } if (isset($opcions[$titol][$k])) { $opcionsAra=$opcions[$titol][$k]; } else{ $opcionsAra=""; } $retVal.=posacamppremis($k2,$v2,$k,$opcionsAra,$valorDefault[$titol][$k]); if (isset($htmlPropi[$titol][$k]['posthtml'])) { $retVal.=$htmlPropi[$titol][$k]['posthtml']; } } } $retVal.="
"; return $retVal; } function posaformpremis() { global $apartats,$titolApartat,$formulari,$opcions,$propietatsdiari,$seccio,$previewPremis; if ($previewPremis==1) { $olsec=$seccio;$seccio.="&previewPremis=1"; } echo "
"; if ($previewPremis==1) { $seccio=$oldsec; } foreach ($apartats as $k=>$v) { echo posafieldsetpremis($v,$formulari[$v]); } echo ""; echo "
"; } //$mostraform=1; if ($_POST['envia']==1) { /*echo "
";
    print_r($_POST);
    echo "
";*/ $SQL2="SELECT * FROM $taulaPremis WHERE IDusuari=".$idusuario." AND volta=".$voltaVotacions; $res2=@bbdd_query($SQL2); if (@bbdd_num_rows($res2)>0) { echo "
Ja heu votat anteriorment, o heu fet més d'un click al botó d'enviar i la vostra votació ha estat processada anteriorment de forma correcta
"; $noMostris=1; } else { $txtInsert1=""; $txtInsert2=""; foreach ($_POST as $k=>$v) { $partscamp=explode("_",$k); if ($partscamp[0]=="camp") { $nomcamp="camp".$partscamp[1]; if (strlen($txtInsert1)>0) { $txtInsert1.=","; $txtInsert2.=","; } $txtInsert1.=$nomcamp; $txtInsert2.="'".addslashes($v)."'"; } } $fecha=time(); $idusuario=intval($idusuario); $SQL = "INSERT INTO $taulaPremis ($txtInsert1,fecha,IDusuari,volta) VALUES ($txtInsert2,$fecha,$idusuario,$voltaVotacions)"; if (@bbdd_query($SQL)) { echo "
La vostra votació s'ha registrat correctament.

Gràcies per participar!
"; $noMostris=1; } } //echo $SQL."
"; } if ($noMostris==0) { posaformpremis(); } } if ($_GET['netejataula']==1) { $SQL = "DELETE FROM $taulaPremis"; bbdd_query($SQL); echo "Neteja feta"; } ?>