<?php
/************************************************************************/
/* Maximus CMS: Web Portal System                                       */
/* ==============================                                       */
/*                                                                      */
/* Copyright (c) 2002 - 2006                                            */
/* http://www.php-maximus.fr                                            */
/* dev@php-maximus.org                                                  */
/*                                                                      */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License.       */
/************************************************************************/
/* Based on PHP-NUKE: Web Portal System                                 */
/************************************************************************/
/********************************************************/
/* NukeSentinel(tm)                                     */
/* By: NukeScripts Network (webmaster@nukescripts.net)  */
/* http://www.nukescripts.net                           */
/* Copyright © 2000-2005 by NukeScripts Network         */
/********************************************************/

if (!defined('ADMIN_ALLOW') && !defined('ADMIN_MAX')) {
	die ("Access Denied");
}

$old_masscidr = ABGetCIDRs($ip_lo, $ip_hi);
if ($ab_config['htaccess_path'] != "") {
  $old_masscidr = explode("||", $old_masscidr);
  for ($i=0; $i < sizeof($old_masscidr); $i++) {
    if ($old_masscidr[$i]!="") {
      $old_masscidr[$i] = "deny from ".$old_masscidr[$i]."\n";
    }
  }
  $ipfile = file($ab_config['htaccess_path']);
  $ipfile = implode("", $ipfile);
  $ipfile = str_replace($old_masscidr, "", $ipfile);
  $ipfile = $ipfile;
  $doit = fopen($ab_config['htaccess_path'], "w");
  fwrite($doit, $ipfile);
  fclose($doit);
}
$db->sql_query("DELETE FROM `".TABLE_NSNST_BLOCKED_RANGES."` WHERE `ip_lo`='$ip_lo' AND `ip_hi`='$ip_hi'");
$db->sql_query("OPTIMIZE TABLE `".TABLE_NSNST_BLOCKED_RANGES."`");
redirect_url("".$admin_file.".php?op=$xop&min=$min&column=$column&direction=$direction&sip=$sip");