- Timestamp:
- 01/06/10 13:09:31 (15 years ago)
- Location:
- trunk/dnsbl
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dnsbl/DNSBL.pm
r10 r11 206 206 my $block = new NetAddr::IP "$blockin"; # need this to clean up messes like ranges. sigh. 207 207 208 return "$blockin not a single CIDR range" if !$block; 209 208 210 local $dbh->{AutoCommit} = 1; # force autocommit 209 211 210 212 my $sth = $dbh->prepare("INSERT INTO blocks (block,orgid,level) VALUES (?,?,?)"); 211 213 $sth->execute("$block",$orgid,$level); 214 return $sth->errstr if $sth->err; 212 215 # nb: no need to return anything, since the CIDR block is the key 213 216 } -
trunk/dnsbl/dnsbl.cgi
r7 r11 48 48 } 49 49 } elsif ($webvar{page} eq 'dbreport') { 50 my $err = ''; 50 51 my $count = $dnsbl->report($webvar{ip}); 51 52 my $org0id = $dnsbl->orgexists($webvar{org0}); … … 55 56 } 56 57 if (!$dnsbl->blockexists($webvar{block0})) { 57 $dnsbl->addblock($webvar{block0}, $org0id, 0); 58 my $ret = $dnsbl->addblock($webvar{block0}, $org0id, 0); 59 $err .= "error adding $webvar{block0}: $ret<br>\n" if $ret; 58 60 $page->param(block0 => $webvar{block0}); 59 61 } … … 66 68 } 67 69 if (!$dnsbl->blockexists($webvar{block1})) { 68 $dnsbl->addblock($webvar{block1}, $org1id, 1); 70 my $ret = $dnsbl->addblock($webvar{block1}, $org1id, 1); 71 $err .= "error adding $webvar{block1}: $ret<br>\n" if $ret; 69 72 $page->param(block1 => $webvar{block1}); 70 73 } … … 76 79 } 77 80 if (!$dnsbl->blockexists($webvar{block2})) { 78 $dnsbl->addblock($webvar{block2}, $org2id, 2); 81 my $ret = $dnsbl->addblock($webvar{block2}, $org2id, 2); 82 $err .= "error adding $webvar{block2}: $ret<br>\n" if $ret; 79 83 $page->param(block2 => $webvar{block2}); 80 84 } … … 83 87 84 88 $page->param(ip => $webvar{ip}); 89 $page->param(err => $err); 85 90 } 86 91 print $page->output; -
trunk/dnsbl/templates/dbreport.tmpl
r2 r11 11 11 <TMPL_IF org2><br>added <TMPL_VAR NAME=org2></TMPL_IF> 12 12 <TMPL_IF block2><br>added level 2 block <TMPL_VAR NAME=block2></TMPL_IF> 13 <TMPL_IF err><hr><TMPL_VAR NAME=err></TMPL_IF> 13 14 <hr><a href="/">Back</a> 14 15 </body>
Note:
See TracChangeset
for help on using the changeset viewer.