Changeset 171


Ignore:
Timestamp:
02/24/05 15:09:46 (20 years ago)
Author:
Kris Deugau
Message:

/branches/new-search-20050223

First iteration:

  • Changed search linked from header.inc back to a "quick" search, with some intelligence to detect whether it's an IP, CustID, or description that's being searched for.
Location:
branches/new-search-20050223
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/new-search-20050223/cgi-bin/main.cgi

    r167 r171  
    123123    # Search term entered.  Display matches.
    124124    # We should really sanitize $webvar{input}, no?
    125     viewBy($webvar{searchfor}, $webvar{input});
     125    # need to munge up data for $webvar{searchfor}, rather than breaking things here.
     126    my $searchfor;
     127    # Chew up leading and trailing whitespace
     128    $webvar{input} =~ s/^\s+//;
     129    $webvar{input} =~ s/\s+$//;
     130    if ($webvar{input} =~ /^(\d{1,3}\.){3}\d{1,3}\/\d{1,3}$/) {
     131      # "Perfect" IP subnet match
     132      $searchfor = "ipblock";
     133    } elsif ($webvar{input} =~ /^(\d{1,3}\.){3}\d{1,3}$/) {
     134      # "Perfect" IP address match (shows containing block)
     135      $searchfor = "ipblock";
     136    } elsif ($webvar{input} =~ /^(\d{1,3}\.){2}\d{1,3}(\.\d{1,3}?)?/) {
     137      # Partial IP match
     138      $searchfor = "ipblock";
     139    } elsif ($webvar{input} =~ /^\d+$/) {
     140      # All-digits, new custID
     141      $searchfor = "cust";
     142    } else {
     143      # Anything else.
     144      $searchfor = "desc";
     145    }
     146    viewBy($searchfor, $webvar{input});
    126147  }
    127148}
  • branches/new-search-20050223/header.inc

    r87 r171  
    4141<td width=10></td>
    4242<form method="POST" action="/ip/cgi-bin/main.cgi">
    43 <td>Search:
     43<td>Quick Search:
    4444<input type="text" name="input" size="20" maxlength="50" class="regular">
    45 <input type=radio name="searchfor" value="ipblock">IP/IP block
    46 <input type=radio name="searchfor" value="desc" checked=yes>Description
    47 <input type=radio name="searchfor" value="cust">Customer ID
    4845<input type=hidden name=page value="1">
    4946<input type=hidden name=action value="search">
Note: See TracChangeset for help on using the changeset viewer.