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.
File:
1 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}
Note: See TracChangeset for help on using the changeset viewer.