Index: /extensions/Mail_supervisor/include/fonctions.php
===================================================================
--- /extensions/Mail_supervisor/include/fonctions.php	(revision 4228)
+++ /extensions/Mail_supervisor/include/fonctions.php	(revision 4229)
@@ -595,5 +595,5 @@
     		SELECT ".$champs.",COUNT(`id`) as total 
     		FROM `".MAIL_BLACK_LISTE_TABLE."` 
-		    WHERE `ip` LIKE '".$ip."'
+		    WHERE '".$ip."' LIKE `ip` 
   		;";	
 		 $result = @pwg_query($query);
@@ -603,7 +603,7 @@
 	 				$result = @pwg_query($query);
 					}
-	 $datas = mysql_fetch_array($result,MYSQL_ASSOC);
-
+	    $datas = mysql_fetch_array($result,MYSQL_ASSOC);
 		 $nb = $datas['total']; 
+		 
 if ($mails_options[5] == 'on')
 {
@@ -635,7 +635,37 @@
  	if (  $nb > 0 )
 	{
-	    $erreur_message .= $ip . ' | ' . $pays . ' | ' . $region . ' | ' . $ville . ' ==> ';
+	       $query = "
+    		SELECT ".$champs.",COUNT(`id`) as total 
+    		FROM `".MAIL_BLACK_LISTE_TABLE."` 
+		    WHERE '".$ip."' = `ip` 
+  		;";	
+		 $result = @pwg_query($query);
+ 
+	if (!$result) {
+					vérif_base();
+	 				$result = @pwg_query($query);
+					}
+	    $datas = mysql_fetch_array($result,MYSQL_ASSOC);
+		 $nb = $datas['total']; 
+		 
 	    $row  = mysql_fetch_row(pwg_query($query));
-	    $nb =  ($row[7])+1;
+	    $nb =  ($row[7]);
+      $erreur_message .= $ip . ' | ' . $pays . ' | ' . $region . ' | ' . $ville . ' ' . $nb . ' ==> ';	
+  
+  	 if ($nb == 0)
+		 {
+		   	$valeurs=array( 'NULL',
+		            "'".$ip."'",
+					"'".$pays."'",
+					"'".$region."'",	
+					"'".$ville."'",
+					'"adresse"',
+					'"fai" ',
+					1
+	      );
+		  ajout_ligne(MAIL_BLACK_LISTE_TABLE,$superv_bl_champs, $valeurs,true) ;	
+		 
+		 } else {
+		  $nb += 1;
 	 $query ="
 			UPDATE " . MAIL_BLACK_LISTE_TABLE . " 
@@ -649,7 +679,9 @@
 		 $query .= "		
 			`nb` = " . $nb . "
-			  WHERE ip = '". $ip ."' ;
+		    WHERE '".$ip."' = `ip` 
         	";
-				pwg_query($query );
+		
+				pwg_query($query );	
+				}
 	//================================================================================	
 		
Index: /extensions/Mail_supervisor/include/save_info.php
===================================================================
--- /extensions/Mail_supervisor/include/save_info.php	(revision 4228)
+++ /extensions/Mail_supervisor/include/save_info.php	(revision 4229)
@@ -15,4 +15,6 @@
 
   case  'ajout' :
+  
+ $ip_black=str_replace("*","%",$ip_black);
  
 
@@ -21,9 +23,9 @@
     		SELECT `ip` 
     		FROM `".MAIL_BLACK_LISTE_TABLE."` 
-		    WHERE ip = '".$ip_black."'
+		    WHERE  '".$ip_black."' LIKE ip 
   		;";	
-//==============================================================================		
-list($count) = mysql_fetch_row(pwg_query($query));
-//==============================================================================	
+	//==============================================================================		
+	list($count) = mysql_fetch_row(pwg_query($query));
+	//==============================================================================	
 	$valeurs=array( 'NULL',
 		            "'".$ip_black."'",
@@ -42,5 +44,5 @@
   case 'raz':
         $ip_black=str_replace('*',"%",$ip_black);
-  		$query = "DELETE FROM `".MAIL_BLACK_LISTE_TABLE."` WHERE `ip` like '%".$ip_black."%'  ";
+  		$query = "DELETE FROM `".MAIL_BLACK_LISTE_TABLE."` WHERE `ip`  like '%".$ip_black."%' ";
 			pwg_query($query);
    break;
@@ -74,5 +76,5 @@
 	COUNT(H.`IP`) as total  
     FROM '.HISTORY_TABLE.'  AS H 
-	WHERE H.`IP` not LIKE "'.$_SERVER['REMOTE_ADDR'].'"
+	WHERE  "'.$_SERVER['REMOTE_ADDR'].'"not LIKE H.`IP` 
 	';//
 	if (count($liste_bl)>0)
Index: /extensions/Mail_supervisor/main.inc.php
===================================================================
--- /extensions/Mail_supervisor/main.inc.php	(revision 4228)
+++ /extensions/Mail_supervisor/main.inc.php	(revision 4229)
@@ -2,5 +2,5 @@
 /*
 Plugin Name: Mail supervisor
-Version: 1.2.6.a
+Version: 1.2.6
 Description: Mail supervisor surveille l'envoie des mails.
 Plugin URI: http://piwigo.org/ext/extension_view.php?eid=315
