--- a/wiki.pl
+++ b/wiki.pl
@@ -2771,6 +2771,11 @@ sub UserIsBanned {
   $host = &GetRemoteHost(0);
   foreach (split(/\n/, $data)) {
     next  if ((/^\s*$/) || (/^#/));  # Skip empty, spaces, or comments
+    if ($_ eq "unknown") { return 1 if ($host =~ /^[\d.]+$/); next; } # Ban unknown hosts
+    if ($_ eq "unknown+unregistered") { # Check whether the user is registered
+      return 1 if ($host =~ /^[\d.]+$/ and &GetParam('username','') eq '');
+      next;
+    }
     return 1  if ($ip   =~ /$_/i);
     return 1  if ($host =~ /$_/i);
   }
@@ -4530,7 +4535,10 @@ sub DoEditBanned {
         "<tt># blocks exact IP address</tt><br>",
         "<tt>^123\\.21\\.3\\.9\$</tt><br>",
         "<tt># blocks whole 123.21.3.* IP network</tt><br>",
-        "<tt>^123\\.21\\.3\\.\\d+\$</tt><p>";
+        "<tt>^123\\.21\\.3\\.\\d+\$</tt><br>",
+        "<tt># the special token 'unknown' blocks all unresolvable addresses</tt><br>",
+        "<tt># using 'unknown+unregistered' blocks unregistered users only</tt><br>",
+        "<tt>unknown</tt><p>";
   print &GetTextArea('banlist', $banList, 12, 50);
   print "<br>", $q->submit(-name=>'Save'), "\n";
   print $q->endform;
