#!/usr/bin/perl # ipdb/cgi-bin/search.cgi # Started splitting search functions (quick and otherwise) from # main IPDB interface 03/11/2005 ### # SVN revision info # $Date: 2011-09-23 21:36:06 +0000 (Fri, 23 Sep 2011) $ # SVN revision $Rev: 502 $ # Last update by $Author: kdeugau $ ### # Copyright 2005-2010 - Kris Deugau use strict; use warnings; use CGI::Carp qw(fatalsToBrowser); use CGI::Simple; use HTML::Template; use DBI; use CommonWeb qw(:ALL); use POSIX qw(ceil); use NetAddr::IP; # don't remove! required for GNU/FHS-ish install from tarball ##uselib## use MyIPDB; # Don't formally need a username or syslog here. syslog left active for debugging. use Sys::Syslog; openlog "IPDBsearch","pid","$IPDB::syslog_facility"; # ... but we do *use* the username on ACLs now. # Collect the username from HTTP auth. If undefined, we're in # a test environment, or called without a username. my $authuser; if (!defined($ENV{'REMOTE_USER'})) { $authuser = '__temptest'; } else { $authuser = $ENV{'REMOTE_USER'}; } # Global variables my $RESULTS_PER_PAGE = 25; # anyone got a better name? :P my $thingroot = $ENV{SCRIPT_FILENAME}; $thingroot =~ s|cgi-bin/search.cgi||; # Set up the CGI object... my $q = new CGI::Simple; # ... and get query-string params as well as POST params if necessary $q->parse_query_string; # Convenience; saves changing all references to %webvar ##fixme: tweak for handling