Index: /branches/new-search-20050223/cgi-bin/main.cgi
===================================================================
--- /branches/new-search-20050223/cgi-bin/main.cgi	(revision 170)
+++ /branches/new-search-20050223/cgi-bin/main.cgi	(revision 171)
@@ -123,5 +123,26 @@
     # Search term entered.  Display matches.
     # We should really sanitize $webvar{input}, no?
-    viewBy($webvar{searchfor}, $webvar{input});
+    # need to munge up data for $webvar{searchfor}, rather than breaking things here.
+    my $searchfor;
+    # Chew up leading and trailing whitespace
+    $webvar{input} =~ s/^\s+//;
+    $webvar{input} =~ s/\s+$//;
+    if ($webvar{input} =~ /^(\d{1,3}\.){3}\d{1,3}\/\d{1,3}$/) {
+      # "Perfect" IP subnet match
+      $searchfor = "ipblock";
+    } elsif ($webvar{input} =~ /^(\d{1,3}\.){3}\d{1,3}$/) {
+      # "Perfect" IP address match (shows containing block)
+      $searchfor = "ipblock";
+    } elsif ($webvar{input} =~ /^(\d{1,3}\.){2}\d{1,3}(\.\d{1,3}?)?/) {
+      # Partial IP match
+      $searchfor = "ipblock";
+    } elsif ($webvar{input} =~ /^\d+$/) {
+      # All-digits, new custID
+      $searchfor = "cust";
+    } else {
+      # Anything else.
+      $searchfor = "desc";
+    }
+    viewBy($searchfor, $webvar{input});
   }
 }
Index: /branches/new-search-20050223/header.inc
===================================================================
--- /branches/new-search-20050223/header.inc	(revision 170)
+++ /branches/new-search-20050223/header.inc	(revision 171)
@@ -41,9 +41,6 @@
 <td width=10></td>
 <form method="POST" action="/ip/cgi-bin/main.cgi">
-<td>Search:
+<td>Quick Search:
 <input type="text" name="input" size="20" maxlength="50" class="regular">
-<input type=radio name="searchfor" value="ipblock">IP/IP block
-<input type=radio name="searchfor" value="desc" checked=yes>Description
-<input type=radio name="searchfor" value="cust">Customer ID
 <input type=hidden name=page value="1">
 <input type=hidden name=action value="search">
