Ignore:
Timestamp:
09/23/11 17:36:06 (13 years ago)
Author:
Kris Deugau
Message:

/branches/htmlform

Remove stale, unused cleanInput(), desanitize() subs in CommonWeb.pm
Quickly hack up search.cgi to remove printAndExit() from CommonWeb.pm
See #15, #26

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/htmlform/cgi-bin/search.cgi

    r481 r502  
    4040}
    4141
     42# Global variables
     43my $RESULTS_PER_PAGE = 25;
     44
     45# anyone got a better name?  :P
     46my $thingroot = $ENV{SCRIPT_FILENAME};
     47$thingroot =~ s|cgi-bin/search.cgi||;
     48
     49# Set up the CGI object...
     50my $q = new CGI::Simple;
     51# ... and get query-string params as well as POST params if necessary
     52$q->parse_query_string;
     53
     54# Convenience;  saves changing all references to %webvar
     55##fixme:  tweak for handling <select multiple='y' size=3> (list with multiple selection)
     56my %webvar = $q->Vars;
     57
     58if (defined($webvar{rpp})) {
     59  ($RESULTS_PER_PAGE) = ($webvar{rpp} =~ /(\d+)/);
     60}
     61
    4262# Why not a global DB handle?  (And a global statement handle, as well...)
    4363# Use the connectDB function, otherwise we end up confusing ourselves
     
    4666my $errstr;
    4767($ip_dbh,$errstr) = connectDB_My;
    48 if (!$ip_dbh) {
    49   printAndExit("Failed to connect to database: $errstr\n");
    50 }
    51 checkDBSanity($ip_dbh);
    52 initIPDBGlobals($ip_dbh);
    53 
    54 # Global variables
    55 my $RESULTS_PER_PAGE = 25;
    56 
    57 # anyone got a better name?  :P
    58 my $thingroot = $ENV{SCRIPT_FILENAME};
    59 $thingroot =~ s|cgi-bin/search.cgi||;
    60 
    61 # Set up the CGI object...
    62 my $q = new CGI::Simple;
    63 # ... and get query-string params as well as POST params if necessary
    64 $q->parse_query_string;
    65 
    66 # Convenience;  saves changing all references to %webvar
    67 ##fixme:  tweak for handling <select multiple='y' size=3> (list with multiple selection)
    68 my %webvar = $q->Vars;
    69 
    70 if (defined($webvar{rpp})) {
    71   ($RESULTS_PER_PAGE) = ($webvar{rpp} =~ /(\d+)/);
     68if ($ip_dbh) {
     69  checkDBSanity($ip_dbh);
     70  initIPDBGlobals($ip_dbh);
    7271}
    7372
     
    8887print "Content-type: text/html\n\n", $header->output;
    8988
    90 if ($webvar{stype} eq 'q') {
     89# Handle the DB error first
     90if (!$ip_dbh) {
     91  $page = HTML::Template->new(filename => "dberr.tmpl");
     92  $page->param(errmsg => $errstr);
     93} elsif ($webvar{stype} eq 'q') {
    9194  # Quick search.
    9295
     
    131134    $sqlconcat = "UNION";
    132135  } else {
    133     # We can't get here.  PTHBTT!
    134     printAndExit "PTHBTT!!  Your search has been rejected due to Microsoft excuse #4432: ".
    135         "Not enough mana";
     136    # sum-buddy tryn'a game the system.  Match "all"
     137    $sqlconcat = "INTERSECT";
    136138  }
    137139
     
    210212        "text(cidr) like '$webvar{cidr}%')";
    211213  } else {
    212     # This shouldn't happen, but if it does, whoever gets it deserves what they get...
    213     printAndExit("Invalid netblock query.");
     214    # do nothing.
     215    ##fixme  we'll ignore this to clear out the references to legacy code.
    214216  } # done with CIDR query options.
    215217
Note: See TracChangeset for help on using the changeset viewer.