--- a/branches/2.5.4/cgi-bin/yabb2/Sources/Guardian.pm
+++ b/branches/2.5.4/cgi-bin/yabb2/Sources/Guardian.pm
@@ -1,6 +1,6 @@
 ###############################################################################
 # Guardian.pm                                                                 #
-# $Date: 2013-06-25 15:33:13 +0000 (Tue, 25 Jun 2013) $
+# $Date: 2013-07-12 15:49:28 +0000 (Fri, 12 Jul 2013) $
 ###############################################################################
 # YaBB: Yet another Bulletin Board                                            #
 # Open-Source Community Software for Webmasters                               #
@@ -18,7 +18,7 @@
 use CGI::Carp qw(fatalsToBrowser);
 our $VERSION = '2.5.4';
 
-$guardianpmver = 'YaBB 2.5.4 $Revision: 1081 $';
+$guardianpmver = 'YaBB 2.5.4 $Revision: 1088 $';
 
 $not_from   = qq~$webmaster_email~;
 $not_to     = qq~$webmaster_email~;
@@ -657,6 +657,21 @@
         }
     }
     if ( $use_htaccess && ( $action eq 'add' || $action eq 'remove' ) ) {
+        my %seen   = ();
+        my @allban = ();
+    
+       *ban_dupcheck = sub {
+            my @in = @_;
+            foreach my $item (@in) { $seen{$item} = 1 }
+
+            foreach my $item (@denies) {
+                if ( !$seen{$item} ) {
+                    push @allban, $item;
+                }
+            }
+        };
+        ban_dupcheck(@denies);
+
         fopen( HTA, '>.htaccess' );
         print {HTA} '# Last modified by The Guardian: '
           . timeformat( $date, 1 )
@@ -665,7 +680,7 @@
         print {HTA} @htout or croak 'cannot print to HTA';
         if ($value) {
             print {HTA} "\n$htheader\n" or croak 'cannot print to HTA';
-            foreach (@denies) {
+            foreach (@allban) {
                 if ( $_ ne $value ) {
                     print {HTA} "Deny from $_\n"
                       or croak 'cannot print to HTA';