Index: trunk/admin/modules/Elezioni/aggiornadb.php
===================================================================
--- trunk/admin/modules/Elezioni/aggiornadb.php	(revision 423)
+++ trunk/admin/modules/Elezioni/aggiornadb.php	(revision 424)
@@ -114,5 +114,5 @@
 if(controllo($prefix.'_authors','admincomune',++$num))
 {
-	$sql="UPDATE `".$prefix."_authors` SET `adminop` = '1', `adminsuper` = '0',`admincomune` = '0' WHERE `".$prefix."_authors`.`aid` != 'admin' AND `".$prefix."_authors`.`adminsuper` != '1'";
+	$sql="UPDATE `".$prefix."_authors` SET `adminsuper` = '0',`admincomune` = '0' WHERE `".$prefix."_authors`.`aid` != 'admin' AND `".$prefix."_authors`.`adminsuper` != '1'";
 	$ret=aggiorna($sql,$dbi,'',$num);
 	$sql="UPDATE `".$prefix."_authors` SET `adminop` = '0', `adminsuper` = '0',`admincomune` = '1' WHERE `".$prefix."_authors`.`aid` = 'admin' and `".$prefix."_authors`.`adminsuper` != '1'";
Index: trunk/admin/modules/Elezioni/aggiornamento.php
===================================================================
--- trunk/admin/modules/Elezioni/aggiornamento.php	(revision 423)
+++ trunk/admin/modules/Elezioni/aggiornamento.php	(revision 424)
@@ -185,5 +185,5 @@
 $myrev=$_SESSION['localrev'];
 if (isset($_SESSION['forzadb'])) $myrev=378;
-if($newrev==$myrev) {
+if($newrev<=$myrev) {
 	$errmex=1;
 	Header("Location: admin.php?op=aggiorna&id_cons_gen=$id_cons_gen&errmex=$errmex"); exit;
Index: trunk/admin/modules/Elezioni/controllo_votanti.php
===================================================================
--- trunk/admin/modules/Elezioni/controllo_votanti.php	(revision 423)
+++ trunk/admin/modules/Elezioni/controllo_votanti.php	(revision 424)
@@ -131,5 +131,5 @@
 			if($tot_u) $perc_u=number_format($votiu*100/$tot_u,2);
 			if($tot_d) $perc_d=number_format($votid*100/$tot_d,2);
-			$perc_c=number_format($somma*100/$tot_compl,2);
+			if($tot_compl) $perc_c=number_format($somma*100/$tot_compl,2);
 		}
 		else
Index: trunk/admin/modules/Elezioni/ele.php
===================================================================
--- trunk/admin/modules/Elezioni/ele.php	(revision 423)
+++ trunk/admin/modules/Elezioni/ele.php	(revision 424)
@@ -66,5 +66,5 @@
 function ele() {
 
-	global $espandi, $aid, $bgcolor1, $bgcolor2,$bgcolor5, $prefix, $dbi, $offset, $min,$descr_cons, $id_cons_gen,$tipo_cons,$genere,$op,$id_comune,$perms,$id_cons,$votog,$votol,$votoc,$votocirc,$tema,$fascia,$limite;
+	global $espandi, $aid, $bgcolor1, $bgcolor2,$bgcolor5, $prefix, $dbi, $offset, $min,$descr_cons, $id_cons_gen,$tipo_cons,$genere,$op,$id_comune,$perms,$id_cons,$votog,$votol,$votoc,$votocirc,$tema,$fascia,$limite,$BACKUP;
 
 	include ("header.php");
@@ -162,44 +162,44 @@
 	if ($perms>128) {
 	
-	
 #		<a href=\"admin.php?op=inscollegi&amp;id_cons_gen=$id_cons_gen\">$bullet"._COLLEGI."</a><br>
 	
-	echo "
+		echo "
 		<tr align=\"left\" bgcolor=\"$bgcolor1\">
 		<td valign=\"top\" align=\"center\" bgcolor=\"#000000\" rowspan=\"3\"><font face=\"Arial,Helvetica\" size=-1><font color=\"#ffffff\"><b>"._SUPER."
-
-              </b></font></font>
-		
-		</td>
-<td valign=\"top\" align=\"left\" width=\"150\">		
-		
-		
-		<a href=\"admin.php?op=configurazione&amp;id_cons_gen=$id_cons_gen\">$bullet"._CONFIGURAZIONE."</a><br>";
-		if($op=="configurazione" || $op=="widget" || $op=="plugin"){ 
-		    echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - <a href=\"admin.php?op=widget&amp;id_cons_gen=$id_cons_gen\"> "._WIDGET."</a>";
-		    echo "<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - "._PLUGINS."";
-		    echo "<hr>";
-		}
-		$newrev=$_SESSION['remoterev'];
-		$myrev=$_SESSION['localrev'];
-		if($newrev==$myrev or $newrev==0) echo "<a href=\"admin.php?op=aggiorna&amp;id_cons_gen=$id_cons_gen\">$bullet"._AGGIORNA."</a><br>";
-		else	echo "<a href=\"admin.php?op=aggiorna&amp;id_cons_gen=$id_cons_gen\">$bullet_red<b>"._AGGIORNA."</b></a><br>";
-		echo "<a href=\"admin.php?op=confconsiglio&amp;id_cons_gen=$id_cons_gen\">$bullet"._CONFCONS."</a>
-		</td></tr><tr align=\"left\" bgcolor=\"$bgcolor1\"><td>
-		<a href=\"admin.php?op=inscomuni&amp;id_cons_gen=$id_cons_gen\">$bullet"._DEFCOMUNE."</a><br>
-		<a href=\"admin.php?op=oper_admin&amp;id_cons_gen=$id_cons_gen\">$bullet"._AMMINISTRATORI."</a>
-		</td></tr><tr align=\"left\" bgcolor=\"$bgcolor1\"><td>
-		<a href=\"admin.php?op=consultazione&amp;id_cons_gen=$id_cons_gen\">$bullet"._CONSULTAZIONE_ADM."</a><br>";
-echo "<a href=\"admin.php?op=rec_add_aff&amp;id_cons_gen=$id_cons_gen\">$bullet"._AFFLUENZE."</a><br>
-		<a href=\"admin.php?op=associazioni&amp;id_cons_gen=$id_cons_gen\">$bullet"._INSCOMUNE."</a>
-		</td></tr>";
-#		<br><a href=\"http://www.eleonline.it/portal/segnala.php?tmp=test123\" target=\"_blank\">$bullet_red <b>"._SEGNALA."</b></a>
-
-#		<a href=\"admin.php?op=backup&amp;id_cons_gen=$id_cons_gen\">$bullet"._BACKUP."</a><br>
-#		<a href=\"admin.php?op=restore&amp;id_cons_gen=$id_cons_gen\">$bullet"._RESTORE."</a>
-		
-	} 
+		</b></font></font>
+		</td>";
+		if(!$BACKUP){
+			echo "<td valign=\"top\" align=\"left\" width=\"150\">";		
+			echo "<a href=\"admin.php?op=configurazione&amp;id_cons_gen=$id_cons_gen\">$bullet"._CONFIGURAZIONE."</a><br>";
+			if($op=="configurazione" || $op=="widget" || $op=="plugin"){ 
+				echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - <a href=\"admin.php?op=widget&amp;id_cons_gen=$id_cons_gen\"> "._WIDGET."</a>";
+				echo "<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - "._PLUGINS."";
+				echo "<hr>";
+			}
+			$newrev=$_SESSION['remoterev'];
+			$myrev=$_SESSION['localrev'];
+			if($newrev==$myrev or $newrev==0) echo "<a href=\"admin.php?op=aggiorna&amp;id_cons_gen=$id_cons_gen\">$bullet"._AGGIORNA."</a><br>";
+			else	echo "<a href=\"admin.php?op=aggiorna&amp;id_cons_gen=$id_cons_gen\">$bullet_red<b>"._AGGIORNA."</b></a><br>";
+			echo "<a href=\"admin.php?op=confconsiglio&amp;id_cons_gen=$id_cons_gen\">$bullet"._CONFCONS."</a>
+			</td></tr><tr align=\"left\" bgcolor=\"$bgcolor1\"><td>
+			<a href=\"admin.php?op=inscomuni&amp;id_cons_gen=$id_cons_gen\">$bullet"._DEFCOMUNE."</a><br>
+			<a href=\"admin.php?op=oper_admin&amp;id_cons_gen=$id_cons_gen\">$bullet"._AMMINISTRATORI."</a>
+			</td></tr><tr align=\"left\" bgcolor=\"$bgcolor1\"><td>
+			<a href=\"admin.php?op=consultazione&amp;id_cons_gen=$id_cons_gen\">$bullet"._CONSULTAZIONE_ADM."</a><br>";
+			echo "<a href=\"admin.php?op=rec_add_aff&amp;id_cons_gen=$id_cons_gen\">$bullet"._AFFLUENZE."</a><br>
+			<a href=\"admin.php?op=associazioni&amp;id_cons_gen=$id_cons_gen\">$bullet"._INSCOMUNE."</a>";
+		}else{
+			echo "</tr><tr align=\"left\" bgcolor=\"$bgcolor1\"><td valign=\"top\" align=\"left\" width=\"150\"  rowspan=\"2\">";		
+			echo "<a href=\"admin.php?op=aggcons&amp;id_cons_gen=$id_cons_gen\">$bullet"._AGGDATI."</a>";
+			echo "</td></tr><tr><td>";
+		}
+		echo "</td></tr>";
+	#		<br><a href=\"http://www.eleonline.it/portal/segnala.php?tmp=test123\" target=\"_blank\">$bullet_red <b>"._SEGNALA."</b></a>
+
+	#		<a href=\"admin.php?op=backup&amp;id_cons_gen=$id_cons_gen\">$bullet"._BACKUP."</a><br>
+			
+	}
 //	Amministrazione locale solo superuser e adminuser
-	if ($perms>16 and ! $espandi) {
+	if ($perms>16 and ! $espandi and !$BACKUP) {
 		echo "
 		<tr bgcolor=\"$bgcolor1\">
@@ -267,5 +267,5 @@
 	<td valign=\"top\" width=\"150\">";
 	if ($op!='consultazione' and $perms>0 and $nrcirco and ($nrlista or $nrgruppo) and ! $espandi) {
-			echo "<a href=\"admin.php?op=voti&amp;id_cons_gen=$id_cons_gen&amp;do=spoglio\">$bullet "._GEST." "._SPOGLIO."</a><br>";
+			if(!$BACKUP) echo "<a href=\"admin.php?op=voti&amp;id_cons_gen=$id_cons_gen&amp;do=spoglio\">$bullet "._GEST." "._SPOGLIO."</a><br>";
 		if ($nraff) {
 			echo "<a href=\"admin.php?op=controllo_votanti&amp;id_cons_gen=$id_cons_gen\">$bullet "._STATO." "._AFFLUENZE."</a><br>";
Index: trunk/admin/modules/Elezioni/ele_cons_comuni.php
===================================================================
--- trunk/admin/modules/Elezioni/ele_cons_comuni.php	(revision 423)
+++ trunk/admin/modules/Elezioni/ele_cons_comuni.php	(revision 424)
@@ -149,5 +149,5 @@
 function cons_comuni($ok, $id_cons2,$do, $duplica,$elettori) 
 {
- global $prefix, $dbi,$id_comune,$id_cons_gen,$perms,$predefinita;
+ global $prefix, $dbi,$id_comune,$id_cons_gen,$perms,$predefinita,$chiusa;
 if ($perms>32) {
 	$sql="select id_cons from ".$prefix."_ele_cons_comune where id_cons_gen='$id_cons_gen' and id_comune=$id_comune";
@@ -236,5 +236,5 @@
 			$result->execute();	
 		}else{
-			$sql="update  ".$prefix."_ele_cons_comune set  chiusa='$chiusa' WHERE id_cons2='$id_cons2'";
+			$sql="update  ".$prefix."_ele_cons_comune set  chiusa='$chiusa' WHERE id_cons='$id_cons2'";
 			$result = $dbi->prepare("$sql");
 			$result->execute();	
Index: trunk/admin/modules/Elezioni/ele_controlli.php
===================================================================
--- trunk/admin/modules/Elezioni/ele_controlli.php	(revision 423)
+++ trunk/admin/modules/Elezioni/ele_controlli.php	(revision 424)
@@ -308,5 +308,5 @@
 	$res->execute();
 	list($prefs,$disg,$solog,$fascia,$id_conf)=$res->fetch(PDO::FETCH_NUM);
-	$sql="SELECT supdisgiunto FROM ".$prefix."_ele_conf where id_conf='$id_conf'";
+	$sql="SELECT supdisgiunto FROM ".$prefix."_ele_conf where id_conf='$id_conf'"; 
 	$res = $dbi->prepare("$sql");
 	$res->execute();
@@ -361,5 +361,5 @@
 			$res = $dbi->prepare("$sql");
 			$res->execute();
-			list($votiv,$validil,$contestatil,$nullil,$solog,$solol) = $res->fetch(PDO::FETCH_NUM);
+			list($votiv,$validil,$contestatil,$nullil,$solovg,$solol) = $res->fetch(PDO::FETCH_NUM);
 			$vl=0;
 			$tvl=0;
@@ -391,18 +391,18 @@
 						$tnl+=$nl; 
 						if(($votig+$svl)!=($votil+$svg+$nl) and (!$supdis and !$disg))
-						{ $err=1; $tipo='lista'; break; }
+						{  $err=1; $tipo='lista'; break; }
 					}
 					$totg+=($votig+$svl);$totl+=($votil+$svg+$nl); #$svl da ele_voti_gruppo e $solog da ele_sezioni
 					
 				}
-				if(($totg)!=($totl+$nullil+$contestatil) or $totsg!=$solog)
-				{ $err=1; $tipo='lista';}
+				if(($totg+$totsg)!=($totl+$nullil+$contestatil+$solovg) or ($totsg!=$solovg and $solog))
+				{$err=1; $tipo='lista';} 
 				
 			}else{
 			#inserire controllo per consultazioni con voto alle liste ma senza voto di gruppo	
 			}
-			if (!$totsg) $totsg=$solog; 
+			if (!$totsg) $totsg=$solovg; 
 			if (($totlis!=$validil or $validil+$contestatil+$nullil+$totsg!=$votiv) and ($validil+$contestatil+$nullil+$solol>0 or $tvl>0)) {$err=1;$tipo='lista';} 
-			if(($solog && !$disg && ($tnl!=$nullil && $disg)) || $totsl!=$solol || ($totsg!=$solog)) {$err=1;$tipo='lista';}
+			if(($solovg && !$disg && ($tnl!=$nullil && $disg)) || $totsl!=$solol || ($totsg!=$solovg)) {$err=1;$tipo='lista';}
 		}		
 	}
Index: trunk/admin/modules/Elezioni/ele_gruppo.php
===================================================================
--- trunk/admin/modules/Elezioni/ele_gruppo.php	(revision 423)
+++ trunk/admin/modules/Elezioni/ele_gruppo.php	(revision 424)
@@ -14,5 +14,5 @@
 
 // Offset - visualizza il numero di elementi per pagina
-$offset=5;
+if(isset($offsetgruppi) and $offsetgruppi>0) $offset=$offsetgruppi; else $offset=5;
 global $dbi;
 $aid=$_SESSION['aid'];
Index: trunk/admin/modules/Elezioni/ele_riepilogovoti.php
===================================================================
--- trunk/admin/modules/Elezioni/ele_riepilogovoti.php	(revision 423)
+++ trunk/admin/modules/Elezioni/ele_riepilogovoti.php	(revision 424)
@@ -67,8 +67,8 @@
 
 ################# calcolo voti di lista espressi
-	$sql="select sum(validi_lista),sum(nulli+bianchi+voti_nulli+contestati+solo_gruppo),sum(voti_nulli_lista),sum(contestati_lista) from ".$prefix."_ele_sezioni where id_cons='$id_cons'";
+	$sql="select sum(validi_lista),sum(nulli+bianchi+voti_nulli+contestati+solo_gruppo),sum(voti_nulli_lista),sum(contestati_lista),sum(solo_gruppo) from ".$prefix."_ele_sezioni where id_cons='$id_cons'";
 	$resperc = $dbi->prepare("$sql");
 	$resperc->execute();	
-	list($scruvalidi,$scrunulli,$nullista,$contlista)=$resperc->fetch(PDO::FETCH_NUM);
+	list($scruvalidi,$scrunulli,$nullista,$contlista,$sgs)=$resperc->fetch(PDO::FETCH_NUM);
 
 	if($totschede)
@@ -96,5 +96,7 @@
 		list($num_gruppo,$descrg)=$resg2->fetch(PDO::FETCH_NUM);
 
-		echo "<tr style=\"border-top: 2px solid;\"><td rowspan=\"$numliste\">$descrg</td><td rowspan=\"$numliste\" align=\"right\"><h2>".number_format($votigruppo,0,',','.')."</h2></td><td rowspan=\"$numliste\" align=\"right\"><h2>".number_format($sologruppo,0,',','.')."</h2></td>";
+		echo "<tr style=\"border-top: 2px solid;\"><td rowspan=\"$numliste\">$descrg</td><td rowspan=\"$numliste\" align=\"right\"><h2>".number_format($votigruppo,0,',','.')."</h2></td><td rowspan=\"$numliste\" align=\"right\"><h2>";
+		if($sologruppo) echo number_format($sologruppo,0,',','.');
+		echo "</h2></td>";
 		$currlst=0;
 		while (list($id_lista,$num_lista,$descrl)=$resl->fetch(PDO::FETCH_NUM))
@@ -110,4 +112,5 @@
 		if(!$currlst) echo "<td></td><td></td></tr>";
 	}
+	if(!$totsg)$totsg=$sgs;
 	echo "<tr style=\"border-top: 2px solid;\"><td rowspan=\"3\"><b>Totale</b></td><td  rowspan=\"3\" align=\"right\"><h1>".number_format($totg,0,',','.')."</h1></td><td  rowspan=\"3\" align=\"right\"><h1>".number_format($totsg,0,',','.')."</h1></td><td align=\"right\"><b>Validi di lista</b></td><td align=\"right\"><h1>".number_format($totl,0,',','.')."</h1></td></tr><tr><td align=\"right\"><b>Nulli di lista</b></td><td align=\"right\"><h1>".number_format($nullista,0,',','.')."</h1></td></tr><tr><td align=\"right\"><b>Contestati di lista</b></td><td align=\"right\"><h1>".number_format($contlista,0,',','.')."</h1></td></tr>";
 	echo "</table></br>";
Index: trunk/admin/modules/Elezioni/ele_spoglio.php
===================================================================
--- trunk/admin/modules/Elezioni/ele_spoglio.php	(revision 423)
+++ trunk/admin/modules/Elezioni/ele_spoglio.php	(revision 424)
@@ -278,5 +278,5 @@
 			echo "<input type=\"hidden\" id=\"pag\" name=\"pag\" value=\"admin.php?id_cons_gen=$id_cons_gen&amp;op=$op&amp;id_sez=$id_sez&amp;id_circ=$id_circ&amp;id_sede=$id_sede&amp;do=spoglio&amp;ops=3&amp;id_lista=\">";
 			echo "<select id=\"id_lista\" name=\"id_lista\" onChange=\"vai_lista('id_lista');\">";
-			if ($id_lista){
+			if ($id_lista){    #TEST spostare la valorizzazione di $ele_lista 
 				echo "<option value=\"0\">"._VOTI_LISTA;
 				$ele_lista=" and t1.id_lista='$id_lista' ";
@@ -498,6 +498,6 @@
 
 
-if($id_lista)		$sql="select t1.* from ".$prefix."_ele_candidati as t1 left join ".$prefix."_ele_lista as t2 on (t1.id_lista=t2.id_lista) WHERE t1.id_cons=$id_cons and t1.id_cons=t2.id_cons $ele_lista $circo ORDER BY t2.num_lista,t1.num_cand";
-else $sql="select 0,'$id_cons',t1.id_lista,'','','','','',0 from ".$prefix."_ele_candidati as t1 left join ".$prefix."_ele_lista as t2 on (t1.id_lista=t2.id_lista) WHERE t1.id_cons=$id_cons and t1.id_cons=t2.id_cons $ele_lista $circo ORDER BY t2.num_lista";
+if($id_lista)		$sql="select t1.* from ".$prefix."_ele_candidati as t1 left join ".$prefix."_ele_lista as t2 on (t1.id_lista=t2.id_lista) WHERE t1.id_cons=$id_cons and t1.id_cons=t2.id_cons $ele_lista ORDER BY t2.num_lista,t1.num_cand";
+else $sql="select 0,'$id_cons',t1.id_lista,'','','','','',0 from ".$prefix."_ele_candidati as t1 left join ".$prefix."_ele_lista as t2 on (t1.id_lista=t2.id_lista) WHERE t1.id_cons=$id_cons and t1.id_cons=t2.id_cons $circo $ele_lista ORDER BY t2.num_lista";
 $result = $dbi->prepare("$sql");
 $result->execute();
Index: trunk/admin/modules/Elezioni/language/lang-it.php
===================================================================
--- trunk/admin/modules/Elezioni/language/lang-it.php	(revision 423)
+++ trunk/admin/modules/Elezioni/language/lang-it.php	(revision 424)
@@ -219,4 +219,5 @@
 define("_SPUNTAELIMINA","Metti la spunta per abilitare la cancellazione dei dati (solo voti e votanti):");
 define("_DATI","i dati dello spoglio");
+define("_AGGDATI","Aggiorna i dati");
 define("_SPUNTALABEL1","Abilita la cancellazione");
 define("_SPUNTALABEL2","Cancella anche candidati e struttura");
Index: trunk/admin/modules/Elezioni/query.sql
===================================================================
--- trunk/admin/modules/Elezioni/query.sql	(revision 423)
+++ trunk/admin/modules/Elezioni/query.sql	(revision 424)
@@ -1,3 +1,3 @@
- <?php
+<?php
 
 if (!defined('ADMIN_FILE')) {
@@ -96,8 +96,8 @@
 function elenco_cons()
 {
-global $perms,$dbi,$prefix,$currentlang,$aid,$id_comune;
+global $perms,$dbi,$prefix,$currentlang,$aid,$id_comune,$giorniaut;
 
 	if ($perms<64) {
-		$sql="select t2.id_cons,t1.descrizione,t4.genere,t1.id_cons_gen,t2.chiusa from ".$prefix."_ele_consultazione as t1, ".$prefix."_ele_cons_comune as t2, ".$prefix."_ele_tipo as t4 where t1.id_cons_gen=t2.id_cons_gen and t2.id_comune=$id_comune and t1.tipo_cons=t4.tipo_cons and date_add(t1.data_fine, interval 3 day)>CURDATE() and t2.id_cons in (select id_cons from ".$prefix."_ele_operatori where aid='$aid' and permessi>0)";
+		$sql="select t2.id_cons,t1.descrizione,t4.genere,t1.id_cons_gen,t2.chiusa from ".$prefix."_ele_consultazione as t1, ".$prefix."_ele_cons_comune as t2, ".$prefix."_ele_tipo as t4 where t1.id_cons_gen=t2.id_cons_gen and t2.id_comune=$id_comune and t1.tipo_cons=t4.tipo_cons and date_add(t1.data_fine, interval $giorniaut day)>CURDATE() and t2.id_cons in (select id_cons from ".$prefix."_ele_operatori where aid='$aid' and permessi>0)";
 	}
 	elseif ($perms<128) { 
Index: trunk/admin/modules/Elezioni/restore.php
===================================================================
--- trunk/admin/modules/Elezioni/restore.php	(revision 423)
+++ trunk/admin/modules/Elezioni/restore.php	(revision 424)
@@ -15,5 +15,5 @@
 $perms=ChiSei(0);
 if ($perms!=256) die("Non hai i permessi per effettuare questa operazione!");
-
+global $LINK,$fileback;
 $param=strtolower($_SERVER['REQUEST_METHOD']) == 'get' ? $_GET : $_POST;
 if (isset($param['datafile'])) $datafile=addslashes($param['datafile']); else $datafile='';
@@ -22,5 +22,5 @@
 ele();
 if (isset($_FILES['datafile']['tmp_name'])) $updfile=$_FILES['datafile']['tmp_name']; else $updfile='';
- if (!is_uploaded_file($updfile)) 
+ if (!is_uploaded_file($updfile) and $LINK=='') 
 # if (!is_uploaded_file($_FILES['datafile']['tmp_name'])) 
 # if (file_exists($datafile))
@@ -33,5 +33,9 @@
 	echo "<td align=\"center\"><input type=\"submit\" name=\"add\" value=\""._OK."\"></td></tr></table></form>";
 ////////////////////////////
-}else{$datafile=$_FILES['datafile']['tmp_name'];
+}else{
+if($LINK=='')
+	$datafile=$_FILES['datafile']['tmp_name'];
+else
+	$datafile=$fileback;
 $arrFile = file($datafile);
 $handle = fopen($datafile, "r");
@@ -123,9 +127,8 @@
 } else $errore=1;
 fclose($handle);
-die("finito");
+echo "<center><h2>Aggiornamento del ".date('d/m/Y H:i')." terminato</h2></center>";
 }
-if (isset($errore))
-	if ($errore) die( _MEX_RESTORE_FAILED);
-	else die( _MEX_RESTORE_OK );
+if (isset($errore) and $errore) echo _MEX_RESTORE_FAILED;
+
 echo"</td></tr></table>";
 include("footer.php");
