Index: /extensions/BanIP/admin.php
===================================================================
--- /extensions/BanIP/admin.php	(revision 31374)
+++ /extensions/BanIP/admin.php	(revision 31375)
@@ -92,8 +92,7 @@
 }  
 
-if (isset($_POST['submitaddipban2'])) {
-	$query = 'UPDATE ' . BANIP_TABLE .' SET ip= "'.$_POST['inserip'].'" WHERE id = '.$_POST['invisibleID'].';';
-	$result = pwg_query($query);
-	$_SESSION['page_infos'] = array(l10n('Ip ban update'));
+if (isset($_POST['submitdeleteall'])) {
+	$query = 'DELETE FROM ' . BANIP_TABLE . ';';
+    pwg_query($query);
 	redirect($admin_base_url);
 }
@@ -111,11 +110,105 @@
 
 if (isset($_POST['submitaddipban'])) {
-	$query = 'INSERT INTO ' . BANIP_TABLE .'(ip) VALUES ("' . $_POST['inserip'] . '");';
-	$result = pwg_query($query);
-	$_SESSION['page_infos'] = array(l10n('Ip ban insert'));
-	redirect($admin_base_url);
-}
-		
-	
+  $plage= explode(".", $_POST['inserip']);
+  if(count($plage)!=4)
+	{
+	  $_SESSION['page_errors'] = array(l10n('This Isn\'t an IP'));
+	  redirect($admin_base_url);
+	}
+  if($plage[3]=='*')
+	{
+	  $query = 'SELECT COUNT(*) AS verif_exist FROM ' . BANIP_TABLE . ' WHERE ip = \'' . $_POST['inserip'] . '\';';
+	  $result = pwg_query($query);
+      $exist=pwg_db_fetch_array($result);
+	  if($exist['verif_exist']>0)
+		{
+		  $_SESSION['page_errors'] = array(l10n('Range IP already banned'));
+		  redirect($admin_base_url);
+		}
+	}
+  $ipaddinrange=$plage[0].".".$plage[1].".".$plage[2].".*";
+  $query = 'SELECT COUNT(*) AS verif_exist FROM ' . BANIP_TABLE . ' WHERE ip = \'' . $ipaddinrange . '\';';
+  $result = pwg_query($query);
+  $exist=pwg_db_fetch_array($result);
+  if($exist['verif_exist']>0)
+	{
+	  $_SESSION['page_errors'] = array(l10n('IP is in a range banned'));
+	  redirect($admin_base_url);
+	}
+  $query = 'SELECT COUNT(*) AS verif_exist FROM ' . BANIP_TABLE . ' WHERE ip = \'' . $_POST['inserip'] . '\';';
+  $result = pwg_query($query);
+  $exist=pwg_db_fetch_array($result);
+  if($exist['verif_exist']>0)
+	{
+	  $_SESSION['page_errors'] = array(l10n('IP already banned'));
+	  redirect($admin_base_url);
+	}
+  if($plage[3]=='*')
+    {
+	  $oldip=$plage[0].".".$plage[1].".".$plage[2].".";
+	  $query = 'DELETE FROM ' . BANIP_TABLE . ' WHERE ip LIKE "' . $oldip . '%";';
+    pwg_query($query);
+	  $_SESSION['page_infos'] = array(l10n('Range Ip ban insert'));
+	}
+  else
+    {
+	  $_SESSION['page_infos'] = array(l10n('Ip ban insert'));
+	}
+  $query = 'INSERT INTO ' . BANIP_TABLE .'(ip) VALUES ("' . $_POST['inserip'] . '");';
+  $result = pwg_query($query);
+  redirect($admin_base_url);
+}
+
+if (isset($_POST['submitaddipban2'])) {
+  $plage= explode(".", $_POST['inserip']);
+  if(count($plage)!=4)
+	{
+	  $_SESSION['page_errors'] = array(l10n('This Isn\'t an IP'));
+	  redirect($admin_base_url);
+	}
+  if($plage[3]=='*')
+	{
+	  $query = 'SELECT COUNT(*) AS verif_exist FROM ' . BANIP_TABLE . ' WHERE ip = \'' . $_POST['inserip'] . '\';';
+	  $result = pwg_query($query);
+      $exist=pwg_db_fetch_array($result);
+	  if($exist['verif_exist']>0)
+		{
+		  $_SESSION['page_errors'] = array(l10n('Range IP already banned'));
+		  redirect($admin_base_url);
+		}
+	}
+  $ipaddinrange=$plage[0].".".$plage[1].".".$plage[2].".*";
+  $query = 'SELECT COUNT(*) AS verif_exist FROM ' . BANIP_TABLE . ' WHERE ip = \'' . $ipaddinrange . '\';';
+  $result = pwg_query($query);
+  $exist=pwg_db_fetch_array($result);
+  if($exist['verif_exist']>0)
+	{
+	  $_SESSION['page_errors'] = array(l10n('IP is in a range banned'));
+	  redirect($admin_base_url);
+	}
+  $query = 'SELECT COUNT(*) AS verif_exist FROM ' . BANIP_TABLE . ' WHERE ip = \'' . $_POST['inserip'] . '\';';
+  $result = pwg_query($query);
+  $exist=pwg_db_fetch_array($result);
+  if($exist['verif_exist']>0)
+	{
+	  $_SESSION['page_errors'] = array(l10n('IP already banned'));
+	  redirect($admin_base_url);
+	}
+  if($plage[3]=='*')
+    {
+	  $oldip=$plage[0].".".$plage[1].".".$plage[2].".";
+	  $query = 'DELETE FROM ' . BANIP_TABLE . ' WHERE ip LIKE "' . $oldip . '%";';
+    pwg_query($query);
+	  $_SESSION['page_infos'] = array(l10n('Range Ip ban update'));
+	}
+  else
+    {
+	  $_SESSION['page_infos'] = array(l10n('Ip ban update'));
+	}
+  $query = 'UPDATE ' . BANIP_TABLE .' SET ip= "'.$_POST['inserip'].'" WHERE id = '.$_POST['invisibleID'].';';
+  $result = pwg_query($query);
+  redirect($admin_base_url);
+}
+
 	break;
 }
Index: /extensions/BanIP/admin.tpl
===================================================================
--- /extensions/BanIP/admin.tpl	(revision 31374)
+++ /extensions/BanIP/admin.tpl	(revision 31375)
@@ -6,4 +6,5 @@
 	<fieldset>
 		<input class="submit" name="submitipban" type="submit" value="{'Add IP ban or IP address range'|@translate}" />
+		<input class="submit" name="submitdeleteall" type="submit" onclick="return confirm('{'Are you sure?'|@translate|@escape:'javascript'}');" value="{'Delete all IP Ban'|@translate}"/>
 	</fieldset>
 </form>
Index: /extensions/BanIP/language/en_UK/description.txt
===================================================================
--- /extensions/BanIP/language/en_UK/description.txt	(revision 31374)
+++ /extensions/BanIP/language/en_UK/description.txt	(revision 31375)
@@ -1,1 +1,1 @@
-Ban IP
+Ban adresse IP or range adresse IP
Index: /extensions/BanIP/language/en_UK/plugin.lang.php
===================================================================
--- /extensions/BanIP/language/en_UK/plugin.lang.php	(revision 31374)
+++ /extensions/BanIP/language/en_UK/plugin.lang.php	(revision 31375)
@@ -29,6 +29,12 @@
 $lang['List IP banned and IP address range'] = 'List IP banned and IP address range';
 $lang['Edit IP banned or IP address range'] = 'Edit IP banned or IP address range';
-$lang['Add IP ban or IP address range'] = 'Add IP ban or IP address range';
 $lang['IP'] = 'IP';
 $lang['Ban IP'] = 'Ban IP';
 $lang['Range IP address banned'] = 'Range IP address banned';
+$lang['Delete all IP Ban'] = 'Delete all IP Ban';
+$lang['This Isn\'t an IP'] = 'This Isn\'t an IP';
+$lang['Range IP already banned'] = 'Range IP already banned';
+$lang['IP is in a range banned'] = 'IP is in a range banned';
+$lang['IP is in a range banned'] = 'IP is in a range banned';
+$lang['IP already banned'] = 'IP already banned';
+$lang['Range Ip ban update'] = 'Range Ip ban update';
