Index: branches/htmlform/cgi-bin/main.cgi
===================================================================
--- branches/htmlform/cgi-bin/main.cgi	(revision 478)
+++ branches/htmlform/cgi-bin/main.cgi	(revision 479)
@@ -46,4 +46,16 @@
 syslog "debug", "$authuser active, $ENV{'REMOTE_ADDR'}";
 
+##fixme there *must* be a better order to do things in so this can go back where it was
+# CGI fiddling done here so we can declare %webvar so we can alter $webvar{action}
+# to show the right page on DB errors.
+# 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 <select multiple='y' size=3> (list with multiple selection)
+my %webvar = $q->Vars;
+
 # Why not a global DB handle?  (And a global statement handle, as well...)
 # Use the connectDB function, otherwise we end up confusing ourselves
@@ -53,7 +65,8 @@
 ($ip_dbh,$errstr) = connectDB_My;
 if (!$ip_dbh) {
-  exitError("Database error: $errstr\n");
-}
-initIPDBGlobals($ip_dbh);
+  $webvar{action} = "dberr";
+} else {
+  initIPDBGlobals($ip_dbh);
+}
 
 # Set up some globals
@@ -66,13 +79,4 @@
 $header->param(addperm => $IPDBacl{$authuser} =~ /a/);
 print "Content-type: text/html\n\n", $header->output;
-
-# 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 <select multiple='y' size=3> (list with multiple selection)
-my %webvar = $q->Vars;
 
 
@@ -153,4 +157,9 @@
   }
   $page->param(nodelist => \@nodelist);
+}
+
+# DB failure.  Can't do much here, really.
+elsif ($webvar{action} eq 'dberr') {
+  $page->param(errmsg => $errstr);
 }
 
@@ -192,6 +201,5 @@
 # Just in case something waaaayyy down isn't in place
 # properly... we exit explicitly.
-exit;
-
+exit 0;
 
 
@@ -1257,25 +1265,2 @@
 
 } # finalDelete
-
-
-# going, going, gone... this sub to be removed Any Day Real Soon Now(TM)
-sub exitError {
-  my $errStr = $_[0];
-  printHeader('','');
-  print qq(<center><p class="regular"> $errStr </p>
-<input type="button" value="Back" onclick="history.go(-1)">
-</center>
-);
-
-  # We print the footer here, so we don't have to do it elsewhere.
-  # include the admin tools link in the output?
-  $footer->param(adminlink => ($IPDBacl{$authuser} =~ /A/));
-
-  print $footer->output;
-
-  exit;
-} # errorExit
-
-
-# Just in case we manage to get here.
-exit 0;
