Changeset 285 for trunk/cgi-bin
- Timestamp:
- 09/21/05 17:58:37 (19 years ago)
- Location:
- trunk/cgi-bin
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/cgi-bin/ipdb.psql
r284 r285 101 101 GRANT ALL on "allocations" to "ipdb"; 102 102 103 CREATE VIEW "searchme" as SELECT allocations.cidr, allocations.custid, allocations."type", allocations.city, allocations.description FROM allocations UNION SELECT poolips.ip, poolips.custid, poolips.type, poolips.city, poolips.descriptionFROM poolips;103 CREATE VIEW "searchme" as SELECT allocations.cidr, allocations.custid, allocations."type", allocations.city, allocations.description, allocations.notes FROM allocations UNION SELECT poolips.ip, poolips.custid, poolips.type, poolips.city, poolips.description, poolips.notes FROM poolips; 104 104 105 105 REVOKE ALL on "searchme" from PUBLIC; -
trunk/cgi-bin/search.cgi
r234 r285 60 60 $webvar{input} =~ s/^\s+//; 61 61 $webvar{input} =~ s/\s+$//; 62 if ($webvar{input} =~ /^[\d\.]+(\/\d{1,3})?$/) { 62 if ($webvar{input} =~ /^\d+$/) { 63 # All-digits, new custID 64 $searchfor = "cust"; 65 } elsif ($webvar{input} =~ /^[\d\.]+(\/\d{1,3})?$/) { 63 66 # IP addresses should only have numbers, digits, and maybe a slash+netmask 64 67 $searchfor = "ipblock"; 65 } elsif ($webvar{input} =~ /^\d+$/) {66 # All-digits, new custID67 $searchfor = "cust";68 68 } else { 69 69 # Anything else. … … 140 140 ## CIDR query options. 141 141 $webvar{cidr} =~ s/\s+//; # Hates the nasty spaceseseses we does. 142 if ($webvar{cidr} =~ /\//) { 142 if ($webvar{cidr} == '') { # We has a blank CIDR. Ignore it. 143 } elsif ($webvar{cidr} =~ /\//) { 143 144 # 209.91.179/26 should show all /26 subnets in 209.91.179 144 145 my ($net,$maskbits) = split /\//, $webvar{cidr}; … … 291 292 print qq(<div class="heading">Searching for descriptions containing '$query'</div><br>\n); 292 293 # Query based on description (includes "name" from old DB). 293 $sql = "select * from searchme where description ilike '%$query%'"; 294 $sql = "select * from searchme where description ilike '%$query%'". 295 " or custid ilike '%$query%'"; 294 296 my $count = countRows($sql); 295 297 $sql .= " order by cidr limit $RESULTS_PER_PAGE offset $offset";
Note:
See TracChangeset
for help on using the changeset viewer.