Index: /trunk/admin/admin.php
===================================================================
--- /trunk/admin/admin.php	(revision 22)
+++ /trunk/admin/admin.php	(revision 23)
@@ -124,5 +124,4 @@
 		$dbi=mysql_connect($dbhost, $dbuname, $dbpass) or die("Connessione non riuscita: " . mysql_error());
 		mysql_select_db($dbname)or die("Connessione non riuscita:" . mysql_error());
-#		mysql_set_charset('utf8', $dbi);
 	mysql_query("SET NAMES 'utf8'", $dbi);
 //---10/05/2009  gestione consultazione predefinita
Index: /trunk/admin/footer.php
===================================================================
--- /trunk/admin/footer.php	(revision 22)
+++ /trunk/admin/footer.php	(revision 23)
@@ -8,5 +8,5 @@
 
 $PHP_SELF=$_SERVER['PHP_SELF'];
-if (eregi("footer.php",$PHP_SELF)) {
+if (preg_match("/footer.php/i",$PHP_SELF)) {
     Header("Location: admin.php");
     die();
Index: /trunk/admin/inc/FCKeditor/editor/filemanager/browser/default/connectors/php/connector.php
===================================================================
--- /trunk/admin/inc/FCKeditor/editor/filemanager/browser/default/connectors/php/connector.php	(revision 22)
+++ /trunk/admin/inc/FCKeditor/editor/filemanager/browser/default/connectors/php/connector.php	(revision 23)
@@ -53,5 +53,5 @@
 	$GLOBALS["UserFilesPath"] = $strBP ;
 }
-if ( ! ereg( '/$', $GLOBALS["UserFilesPath"] ) )
+if ( ! preg_match( '/\/$/', $GLOBALS["UserFilesPath"] ) )
 	$GLOBALS["UserFilesPath"] .= '/' ;
 
@@ -60,5 +60,5 @@
 	$GLOBALS["UserFilesDirectory"] = $Config['UserFilesAbsolutePath'] ;
 
-	if ( ! ereg( '/$', $GLOBALS["UserFilesDirectory"] ) )
+	if ( ! preg_match( '/\/$/', $GLOBALS["UserFilesDirectory"] ) )
 		$GLOBALS["UserFilesDirectory"] .= '/' ;
 }
@@ -86,5 +86,5 @@
 
 	// Check the current folder syntax (must begin and start with a slash).
-	if ( ! ereg( '/$', $sCurrentFolder ) ) $sCurrentFolder .= '/' ;
+	if ( ! preg_match( '/\/$/', $sCurrentFolder ) ) $sCurrentFolder .= '/' ;
 	if ( strpos( $sCurrentFolder, '/' ) !== 0 ) $sCurrentFolder = '/' . $sCurrentFolder ;
 	
Index: /trunk/admin/index.php
===================================================================
--- /trunk/admin/index.php	(revision 22)
+++ /trunk/admin/index.php	(revision 23)
@@ -10,5 +10,5 @@
 		$dbi=mysql_connect($dbhost, $dbuname, $dbpass) or die("Connessione non riuscita: " . mysql_error());
 		mysql_select_db($dbname)or die("Connessione non riuscita:" . mysql_error());
-		mysql_set_charset('utf8', $dbi);
+	mysql_query("SET NAMES 'utf8'", $dbi);
 //---10/05/2009  gestione consultazione predefinita
 //if (!isset($_SESSION['id_comune'])){
Index: /trunk/admin/modules/Elezioni/controllo_votanti.php
===================================================================
--- /trunk/admin/modules/Elezioni/controllo_votanti.php	(revision 22)
+++ /trunk/admin/modules/Elezioni/controllo_votanti.php	(revision 23)
@@ -130,5 +130,5 @@
 		}
 //	$ar['riga2'][$data1.$ora1]="<hr>";
-		if (intval(ereg("[1-9]",$tot[$data1.$ora1]))>0) {
+		if (intval(preg_match("/[1-9]/",$tot[$data1.$ora1]))>0) {
 			for ($i=1;$i<=$num_sez;$i++)
 			{
Index: /trunk/admin/modules/Elezioni/ele_come.php
===================================================================
--- /trunk/admin/modules/Elezioni/ele_come.php	(revision 22)
+++ /trunk/admin/modules/Elezioni/ele_come.php	(revision 23)
@@ -138,5 +138,5 @@
 
 $temp=$title.$preamble.$content;
-	if (eregi("script",$temp)) die("La parola script e' proibita, devi toglierla dal testo.");
+	if (preg_match("/script/i",$temp)) die("La parola script e' proibita, devi toglierla dal testo.");
     $result = mysql_query("update ".$prefix.$tab." set title='$title', preamble='$preamble', content='$content' WHERE mid='$mid' AND id_cons='$id_cons'", $dbi);
     Header("Location: admin.php?op=$op&vai=come&id_cons_gen=$id_cons_gen");
Index: /trunk/admin/modules/Elezioni/ele_voti.php
===================================================================
--- /trunk/admin/modules/Elezioni/ele_voti.php	(revision 22)
+++ /trunk/admin/modules/Elezioni/ele_voti.php	(revision 23)
@@ -1112,5 +1112,5 @@
 
 
- 	if (!ereg("rec",$op)) {
+ 	if (!preg_match("/rec/",$op)) {
 		ele(); //menu
 		numeri_sezione();
Index: /trunk/admin/temi/facebook/menu.php
===================================================================
--- /trunk/admin/temi/facebook/menu.php	(revision 22)
+++ /trunk/admin/temi/facebook/menu.php	(revision 23)
@@ -227,6 +227,6 @@
     	for ($i=0; $i < sizeof($menulist); $i++) {
 		if($menulist[$i]!="") {
-	    		$tl = ereg_replace("lang-","",$menulist[$i]);
-	    		$tl = ereg_replace(".php","",$tl);
+	    		$tl = preg_replace("/lang-/","",$menulist[$i]);
+	    		$tl = preg_replace("/.php/","",$tl);
 	    		$altlang = ucfirst($tl);
                         
Index: /trunk/admin/temi/facebook/tema.php
===================================================================
--- /trunk/admin/temi/facebook/tema.php	(revision 22)
+++ /trunk/admin/temi/facebook/tema.php	(revision 23)
@@ -19,5 +19,5 @@
     	while ($file = readdir($handle)) {
 
-			if ( (ereg("^([_0-9a-zA-Z]+)([_0-9a-zA-Z]{3})$",$file)) ) {
+			if ( (preg_match("/^([_0-9a-zA-Z]+)([_0-9a-zA-Z]{3})$/",$file)) ) {
 
 		   $tlist .= "$file ";
Index: /trunk/client/file.php
===================================================================
--- /trunk/client/file.php	(revision 22)
+++ /trunk/client/file.php	(revision 23)
@@ -10,5 +10,5 @@
 die("<center><img src=src=\"images/logo.gif\" target=\"Logo Avviso Errore\"><br><br><b>Ci sono dei problemi di connessione al DataBase $dbtype, chiediamo scusa per l'inconveniente.<br><br>Provate piu' tardi, Grazie.</b><br><font color=\"#ff0000\">". mysql_error()."</font></center>");
 }
-mysql_set_charset('utf8', $dbi);
+mysql_query("SET NAMES 'utf8'", $dbi);
 if ($fase=='1'){
 	$res = mysql_query("SELECT id_cons_gen,descrizione from ".$prefix."_ele_consultazione order by descrizione",$dbi);
Index: /trunk/client/modules.php
===================================================================
--- /trunk/client/modules.php	(revision 22)
+++ /trunk/client/modules.php	(revision 23)
@@ -35,17 +35,17 @@
 
 foreach ($_GET as $sec_key => $secvalue) {
-    if ((preg_match('/<[^>]*script*\"?[^>]*>/i', $secvalue)) ||
-	(eregi("<[^>]*object*\"?[^>]*>", $secvalue)) ||
-	(eregi("<[^>]*iframe*\"?[^>]*>", $secvalue)) ||
-	(eregi("<[^>]*applet*\"?[^>]*>", $secvalue)) ||
-	(eregi("<[^>]*meta*\"?[^>]*>", $secvalue)) ||
-	(eregi("<[^>]*style*\"?[^>]*>", $secvalue)) ||
-	(eregi("<[^>]*form*\"?[^>]*>", $secvalue)) ||
-	(eregi("<[^>]*img*\"?[^>]*>", $secvalue)) ||
-	(eregi("<[^>]*onmouseover*\"?[^>]*>", $secvalue)) ||
-	(eregi("<[^>]*body*\"?[^>]*>", $secvalue)) ||
-	(eregi("\([^>]*\"?[^)]*\)", $secvalue)) ||
-	(eregi("\"", $secvalue)) ||
-	(eregi("inside_mod", $sec_key))) {
+    if ((preg_match("/<[^>]*script*\"?[^>]*>/i",$secvalue)) ||
+	(preg_match("/<[^>]*object*\"?[^>]*>/i", $secvalue)) ||
+	(preg_match("/<[^>]*iframe*\"?[^>]*>/i", $secvalue)) ||
+	(preg_match("/<[^>]*applet*\"?[^>]*>/i", $secvalue)) ||
+	(preg_match("/<[^>]*meta*\"?[^>]*>/i", $secvalue)) ||
+	(preg_match("/<[^>]*style*\"?[^>]*>/i", $secvalue)) ||
+	(preg_match("/<[^>]*form*\"?[^>]*>/i", $secvalue)) ||
+	(preg_match("/<[^>]*img*\"?[^>]*>/i", $secvalue)) ||
+	(preg_match("/<[^>]*onmouseover*\"?[^>]*>/i", $secvalue)) ||
+	(preg_match("/<[^>]*body*\"?[^>]*>/i", $secvalue)) ||
+	(preg_match("/\([^>]*\"?[^)]*\)/", $secvalue)) ||
+	(preg_match("/\"/", $secvalue)) ||
+	(preg_match("/inside_mod/i", $sec_key))) {
         die ("Operazione non consentita");
      }
@@ -53,5 +53,5 @@
 
   foreach ($_POST as $secvalue) {
-    if ((eregi("<[^>]*onmouseover*\"?[^>]*>", $secvalue)) || (eregi("<[^>]script*\"?[^>]*>", $secvalue)) || (eregi("<[^>]*body*\"?[^>]*>", $secvalue)) || (eregi("<[^>]style*\"?[^>]*>", $secvalue))) {
+    if ((preg_match("/<[^>]*onmouseover*\"?[^>]*>/i", $secvalue)) || (preg_match("/<[^>]script*\"?[^>]*>/i", $secvalue)) || (preg_match("/<[^>]*body*\"?[^>]*>/i", $secvalue)) || (preg_match("/<[^>]style*\"?[^>]*>/i", $secvalue))) {
       die ($htmltags);
     }
@@ -74,7 +74,7 @@
 global $op,$name;
 if(!isset($_GET['js'])){
-$querystring= @eregi_replace($_SERVER['DOCUMENT_ROOT'],'http://'.$_SERVER['HTTP_HOST'].'/',$_SERVER['SCRIPT_FILENAME']);
-if (eregi("modules.php",$_SERVER['SCRIPT_NAME'])) $pagina="name=$name"; // reindirizza
-if (eregi("admin.php",$_SERVER['SCRIPT_NAME'])) $pagina="op=$op"; // reindirizza
+$querystring= @preg_replace('/'.$_SERVER['DOCUMENT_ROOT'].'/i','http://'.$_SERVER['HTTP_HOST'].'/',$_SERVER['SCRIPT_FILENAME']);
+if (preg_match("/modules.php/i",$_SERVER['SCRIPT_NAME'])) $pagina="name=$name"; // reindirizza
+if (preg_match("/admin.php/i",$_SERVER['SCRIPT_NAME'])) $pagina="op=$op"; // reindirizza
  echo "<noscript><meta http-equiv=\"refresh\" content=\"0; url=".$querystring."?js=b&amp;$pagina\"/></noscript>";
   }
@@ -104,5 +104,5 @@
 die("<center><img src=src=\"images/logo.gif\" target=\"Logo Avviso Errore\"><br/><br/><b>Ci sono dei problemi di connessione al DataBase $dbtype, chiediamo scusa per l'inconveniente.<br/><br/>Provate piu' tardi, Grazie.</b><br/><font color=\"#ff0000\">". mysql_error()."</font></center>");
 }
-mysql_set_charset('utf8', $dbi);
+mysql_query("SET NAMES 'utf8'", $dbi);
 
 # carica i parametri di default sulla tabella
@@ -210,9 +210,9 @@
         $tema=$param['tema'];
         $tema=htmlentities($tema); // evita xss
-        if(eregi("%", $tema)) $tema="default";// evita xss
+        if(preg_match("/%/i", $tema)) $tema="default";// evita xss
         $_SESSION['newtema']="$tema";
         }
 
-if (eregi("%",$_SESSION['newtema'])) $_SESSION['newtema']="default"; // xss
+if (preg_match("/%/i",$_SESSION['newtema'])) $_SESSION['newtema']="default"; // xss
 if (isset($_SESSION['newtema'])) $tema=$_SESSION['newtema']; 
 
