Changeset 479 for branches/htmlform/cgi-bin/main.cgi
- Timestamp:
- 09/17/10 18:49:45 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/htmlform/cgi-bin/main.cgi
r478 r479 46 46 syslog "debug", "$authuser active, $ENV{'REMOTE_ADDR'}"; 47 47 48 ##fixme there *must* be a better order to do things in so this can go back where it was 49 # CGI fiddling done here so we can declare %webvar so we can alter $webvar{action} 50 # to show the right page on DB errors. 51 # Set up the CGI object... 52 my $q = new CGI::Simple; 53 # ... and get query-string params as well as POST params if necessary 54 $q->parse_query_string; 55 56 # Convenience; saves changing all references to %webvar 57 ##fixme: tweak for handling <select multiple='y' size=3> (list with multiple selection) 58 my %webvar = $q->Vars; 59 48 60 # Why not a global DB handle? (And a global statement handle, as well...) 49 61 # Use the connectDB function, otherwise we end up confusing ourselves … … 53 65 ($ip_dbh,$errstr) = connectDB_My; 54 66 if (!$ip_dbh) { 55 exitError("Database error: $errstr\n"); 56 } 57 initIPDBGlobals($ip_dbh); 67 $webvar{action} = "dberr"; 68 } else { 69 initIPDBGlobals($ip_dbh); 70 } 58 71 59 72 # Set up some globals … … 66 79 $header->param(addperm => $IPDBacl{$authuser} =~ /a/); 67 80 print "Content-type: text/html\n\n", $header->output; 68 69 # Set up the CGI object...70 my $q = new CGI::Simple;71 # ... and get query-string params as well as POST params if necessary72 $q->parse_query_string;73 74 # Convenience; saves changing all references to %webvar75 ##fixme: tweak for handling <select multiple='y' size=3> (list with multiple selection)76 my %webvar = $q->Vars;77 81 78 82 … … 153 157 } 154 158 $page->param(nodelist => \@nodelist); 159 } 160 161 # DB failure. Can't do much here, really. 162 elsif ($webvar{action} eq 'dberr') { 163 $page->param(errmsg => $errstr); 155 164 } 156 165 … … 192 201 # Just in case something waaaayyy down isn't in place 193 202 # properly... we exit explicitly. 194 exit; 195 203 exit 0; 196 204 197 205 … … 1257 1265 1258 1266 } # finalDelete 1259 1260 1261 # going, going, gone... this sub to be removed Any Day Real Soon Now(TM)1262 sub exitError {1263 my $errStr = $_[0];1264 printHeader('','');1265 print qq(<center><p class="regular"> $errStr </p>1266 <input type="button" value="Back" onclick="history.go(-1)">1267 </center>1268 );1269 1270 # We print the footer here, so we don't have to do it elsewhere.1271 # include the admin tools link in the output?1272 $footer->param(adminlink => ($IPDBacl{$authuser} =~ /A/));1273 1274 print $footer->output;1275 1276 exit;1277 } # errorExit1278 1279 1280 # Just in case we manage to get here.1281 exit 0;
Note:
See TracChangeset
for help on using the changeset viewer.