- Timestamp:
- 05/04/10 16:22:50 (15 years ago)
- Location:
- trunk/dnsbl
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dnsbl/browse.cgi
r7 r19 23 23 "WHERE b.block <<= "; 24 24 my $sth0 = $dbh->prepare($basesql."'0/0' AND b.level=0 ORDER BY block"); 25 #my $sth0 = $dbh->prepare($basesql."' 76.73.0.0/17' AND b.level=0 ORDER BY block");25 #my $sth0 = $dbh->prepare($basesql."'64/8' AND b.level=0 ORDER BY block"); 26 26 my $sth1 = $dbh->prepare($basesql."? AND b.level=1 ORDER BY block"); 27 27 my $sth2 = $dbh->prepare($basesql."? AND b.level=2 ORDER BY block"); … … 32 32 my %ipseen; 33 33 34 my $out = ''; 35 34 36 $sth0->execute; 35 37 while (my ($block0,$org0,$listmeb0,$listmeo0,$bcomments0,$ocomments0) = $sth0->fetchrow_array) { 36 print "<div class=\"lvl0".($dnsbl->autolist_block($block0) ? ' auto0"' : '"'). 37 "><span".($listmeb0 ? ' class=b0list' : '').">$block0". 38 ($listmeb0 ? " ($bcomments0)" : '')."</span> ". 39 "<span".($listmeo0 ? ' class=b0org' : '').">$org0". 40 ($listmeo0 ? " ($ocomments0)" : '')."</span>\n"; 38 my $tmpl0 = new HTML::Template(filename => 'templates/browse-block.tmpl'); 39 $tmpl0->param(lvlclass => 'lvl0'.($dnsbl->autolist_block($block0) ? ' auto0' : '')); 40 $tmpl0->param(netclass => ($listmeb0 ? 'b0list' : '')); 41 $tmpl0->param(net => $block0); 42 $tmpl0->param(orgclass => ($listmeo0 ? 'b0org' : '')); 43 $tmpl0->param(org => $org0); 44 $tmpl0->param(bcomment => $bcomments0) if $bcomments0; 45 $tmpl0->param(ocomment => $ocomments0) if $ocomments0; 41 46 $sth1->execute($block0); 47 my $lvl1out = ''; 42 48 if ($sth1->rows > 0) { 43 49 while (my ($block1,$org1,$listmeb1,$listmeo1,$bcomments1,$ocomments1) = $sth1->fetchrow_array) { 44 # lvl 1 div open 45 print " <div class=\"lvl1".($dnsbl->autolist_block($block1) ? ' auto1"' : '"'). 46 "><span".($listmeb1 ? ' class=b1list' : '').">$block1". 47 ($listmeb1 ? " ($bcomments1)" : '')."</span> ". 48 "<span".($listmeo1 ? ' class=b1org' : '').">$org1". 49 ($listmeo1 ? " ($ocomments1)" : '')."</span>\n"; 50 my $tmpl1 = new HTML::Template(filename => 'templates/browse-block.tmpl'); 51 $tmpl1->param(lvlclass => 'lvl1'.($dnsbl->autolist_block($block1) ? ' auto1' : '')); 52 $tmpl1->param(netclass => ($listmeb1 ? 'b1list' : '')); 53 $tmpl1->param(net => $block1); 54 $tmpl1->param(orgclass => ($listmeo1 ? 'b1org' : '')); 55 $tmpl1->param(org => $org1); 56 $tmpl1->param(bcomment => $bcomments1) if $bcomments1; 57 $tmpl1->param(ocomment => $ocomments1) if $ocomments1; 58 $tmpl1->param(indent => ' '); 59 my $lvl2out = ''; 50 60 $sth2->execute($block1); 51 61 if ($sth2->rows > 0) { 52 while (my ($block2,$org2,$listmeb2,$listmeo2,$bcomments2,$ocomments2) = $sth2->fetchrow_array) { 53 # lvl 2 div open 54 print " <div class=\"lvl2".($dnsbl->autolist_block($block2) ? ' auto2"' : '"'). 55 "><span".($listmeb2 ? ' class=b2list' : '').">$block2". 56 ($listmeb2 ? " ($bcomments2)" : '')."</span> ". 57 "<span".($listmeo2 ? ' class=b2org' : '').">$org2". 58 ($listmeo2 ? " ($ocomments2)" : '')."</span>\n"; 59 $sthiplist->execute($block2); 60 print " <div class=iplist>\n"; 61 while (my @data4 = $sthiplist->fetchrow_array) { 62 print " $data4[0]<br>\n"; 63 $ipseen{$data4[0]} = 1; 64 } 65 print " </div>\n"; 66 # lvl2 div close 67 print " </div>\n"; 68 } 69 } else { 70 $sthiplist->execute($block1); 71 print " <div class=iplist>\n"; 72 while (my @data4 = $sthiplist->fetchrow_array) { 73 print " $data4[0]<br>\n"; 74 $ipseen{$data4[0]} = 1; 75 } 76 print " </div>\n"; 62 while (my ($block2,$org2,$listmeb2,$listmeo2,$bcomments2,$ocomments2) = $sth2->fetchrow_array) { 63 my $tmpl2 = new HTML::Template(filename => 'templates/browse-block.tmpl'); 64 $tmpl2->param(lvlclass => 'lvl2'.($dnsbl->autolist_block($block2) ? ' auto2' : '')); 65 $tmpl2->param(netclass => ($listmeb2 ? 'b2list' : '')); 66 $tmpl2->param(net => $block2); 67 $tmpl2->param(orgclass => ($listmeo2 ? 'b2org' : '')); 68 $tmpl2->param(org => $org2); 69 $tmpl2->param(bcomment => $bcomments2) if $bcomments2; 70 $tmpl2->param(ocomment => $ocomments2) if $ocomments2; 71 $tmpl2->param(indent => ' '); 72 $sthiplist->execute($block2); 73 my @iprows; 74 while (my @data4 = $sthiplist->fetchrow_array) { 75 my %iprow; 76 $iprow{ip} = $data4[0]; 77 $iprow{ipcount} = $data4[1]; 78 $iprow{indent} = ' '; 79 # ip | count | s4list | added 80 push @iprows, \%iprow; 81 $ipseen{$data4[0]} = 1; 82 } 83 $tmpl2->param(iplist => \@iprows); 84 $lvl2out .= $tmpl2->output; 85 } 77 86 } 78 87 79 my $sqlalt = "select ip from iplist where ip << ?"; 80 my $sthalt = $dbh->prepare($sqlalt); 81 $sthalt->execute($block1); 82 my @newips; 83 while (my @data4 = $sthalt->fetchrow_array) { 84 push @newips, $data4[0] if !$ipseen{$data4[0]}; 85 $ipseen{$data4[0]} = 1; 88 $sthiplist->execute($block1); 89 my @iprows; 90 while (my @data4 = $sthiplist->fetchrow_array) { 91 next if $ipseen{$data4[0]}; 92 my %iprow; 93 $iprow{ip} = $data4[0]; 94 $iprow{ipcount} = $data4[1]; 95 $iprow{indent} = ' '; 96 # ip | count | s4list | added 97 push @iprows, \%iprow; 98 $ipseen{$data4[0]} = 1; 86 99 } 87 if ($#newips > -1) { 88 print " <div class=iplist>\n"; 89 foreach (@newips) { 90 print " $_<br>\n"; 91 } 92 print " </div>\n"; 93 } 94 # lvl 1 div close 95 print " </div>\n"; 100 $tmpl1->param(iplist => \@iprows); 101 $tmpl1->param(subs => $lvl2out); 102 $lvl1out .= $tmpl1->output; 96 103 } 97 } else { 98 $sthiplist->execute($block0); 99 print " <div class=iplist>\n"; 100 while (my @data4 = $sthiplist->fetchrow_array) { 101 print " $data4[0]<br>\n"; 102 $ipseen{$data4[0]} = 1; 103 } 104 print " </div>\n"; 104 } # sth1->rows 105 $sthiplist->execute($block0); 106 my @iprows; 107 while (my @data4 = $sthiplist->fetchrow_array) { 108 next if $ipseen{$data4[0]}; 109 my %iprow; 110 $iprow{ip} = $data4[0]; 111 $iprow{ipcount} = $data4[1]; 112 $iprow{indent} = ''; 113 # ip | count | s4list | added 114 push @iprows, \%iprow; 115 $ipseen{$data4[0]} = 1; 105 116 } 117 $tmpl0->param(iplist => \@iprows); 118 $tmpl0->param(subs => $lvl1out); 119 $out .= $tmpl0->output; 120 } 106 121 107 my $sqlalt = "select ip from iplist where ip << ?"; 108 my $sthalt = $dbh->prepare($sqlalt); 109 $sthalt->execute($block0); 110 my @newips; 111 while (my @data4 = $sthalt->fetchrow_array) { 112 push @newips, $data4[0] if (!$ipseen{$data4[0]}); 113 } 114 if ($#newips > -1) { 115 print " <div class=iplist>\n"; 116 foreach (@newips) { 117 print " $_<br>\n"; 118 } 119 print " </div>\n"; 120 } 121 122 print "</div>\n"; 123 } 122 print $out; -
trunk/dnsbl/dnsbl.cgi
r17 r19 114 114 my $out = ''; 115 115 116 my $tmpl0 = new HTML::Template(filename => 'templates/browse-block.tmpl'); 117 116 118 $sth0->execute($ip); 117 119 while (my ($block0,$org0,$listmeb0,$listmeo0,$bcomments0,$ocomments0) = $sth0->fetchrow_array) { 118 $out .= "<div class=\"lvl0".($dnsbl->autolist_block($block0) ? ' auto0"' : '"'). 119 "><span".($listmeb0 ? ' class=b0list' : '').">$block0". 120 ($listmeb0 ? " ($bcomments0)" : '')."</span> ". 121 "<span".($listmeo0 ? ' class=b0org' : '').">$org0". 122 ($listmeo0 ? " ($ocomments0)" : '')."</span>\n"; 120 $tmpl0->param(lvlclass => 'lvl0'.($dnsbl->autolist_block($block0) ? ' auto0' : '')); 121 $tmpl0->param(netclass => ($listmeb0 ? 'b0list' : '')); 122 $tmpl0->param(net => $block0); 123 $tmpl0->param(orgclass => ($listmeo0 ? 'b0org' : '')); 124 $tmpl0->param(org => $org0); 125 $tmpl0->param(bcomment => $bcomments0) if $bcomments0; 126 $tmpl0->param(ocomment => $ocomments0) if $ocomments0; 123 127 $sth1->execute($block0); 128 my $lvl1out = ''; 124 129 if ($sth1->rows > 0) { 125 130 while (my ($block1,$org1,$listmeb1,$listmeo1,$bcomments1,$ocomments1) = $sth1->fetchrow_array) { 126 # lvl 1 div open 127 $out .= " <div class=\"lvl1".($dnsbl->autolist_block($block1) ? ' auto1"' : '"'). 128 "><span".($listmeb1 ? ' class=b1list' : '').">$block1". 129 ($listmeb1 ? " ($bcomments1)" : '')."</span> ". 130 "<span".($listmeo1 ? ' class=b1org' : '').">$org1". 131 ($listmeo1 ? " ($ocomments1)" : '')."</span>\n"; 131 my $tmpl1 = new HTML::Template(filename => 'templates/browse-block.tmpl'); 132 $tmpl1->param(lvlclass => 'lvl1'.($dnsbl->autolist_block($block1) ? ' auto1' : '')); 133 $tmpl1->param(netclass => ($listmeb1 ? 'b1list' : '')); 134 $tmpl1->param(net => $block1); 135 $tmpl1->param(orgclass => ($listmeo1 ? 'b1org' : '')); 136 $tmpl1->param(org => $org1); 137 $tmpl1->param(bcomment => $bcomments1) if $bcomments1; 138 $tmpl1->param(ocomment => $ocomments1) if $ocomments1; 139 $tmpl1->param(indent => ' '); 140 my $lvl2out = ''; 132 141 $sth2->execute($block1); 133 142 if ($sth2->rows > 0) { 134 143 while (my ($block2,$org2,$listmeb2,$listmeo2,$bcomments2,$ocomments2) = $sth2->fetchrow_array) { 135 # lvl 2 div open 136 $out .= " <div class=\"lvl2".($dnsbl->autolist_block($block2) ? ' auto2"' : '"'). 137 "><span".($listmeb2 ? ' class=b2list' : '').">$block2". 138 ($listmeb2 ? " ($bcomments2)" : '')."</span> ". 139 "<span".($listmeo2 ? ' class=b2org' : '').">$org2". 140 ($listmeo2 ? " ($ocomments2)" : '')."</span>\n"; 144 my $tmpl2 = new HTML::Template(filename => 'templates/browse-block.tmpl'); 145 $tmpl2->param(lvlclass => 'lvl2'.($dnsbl->autolist_block($block2) ? ' auto2' : '')); 146 $tmpl2->param(netclass => ($listmeb2 ? 'b2list' : '')); 147 $tmpl2->param(net => $block2); 148 $tmpl2->param(orgclass => ($listmeo2 ? 'b2org' : '')); 149 $tmpl2->param(org => $org2); 150 $tmpl2->param(bcomment => $bcomments2) if $bcomments2; 151 $tmpl2->param(ocomment => $ocomments2) if $ocomments2; 152 $tmpl2->param(indent => ' '); 141 153 $sthiplist->execute($block2); 142 $out .= " <div class=iplist>\n";154 my @iprows; 143 155 while (my @data4 = $sthiplist->fetchrow_array) { 156 my %iprow; 157 $iprow{ip} = $data4[0]; 158 $iprow{ipcount} = $data4[1]; 159 $iprow{indent} = ' '; 144 160 # ip | count | s4list | added 145 $out .= " $data4[0] ($data4[1])<br>\n";161 push @iprows, \%iprow; 146 162 $ipseen{$data4[0]} = 1; 147 163 } 148 $out .= " </div>\n"; 149 # lvl2 div close 150 $out .= " </div>\n"; 164 $tmpl2->param(iplist => \@iprows); 165 $lvl2out .= $tmpl2->output; 151 166 } 152 } else { 153 $sthiplist->execute($block1); 154 $out .= " <div class=iplist>\n"; 155 while (my @data4 = $sthiplist->fetchrow_array) { 167 } 168 169 $sthiplist->execute($block1); 170 my @iprows; 171 while (my @data4 = $sthiplist->fetchrow_array) { 172 next if $ipseen{$data4[0]}; 173 my %iprow; 174 $iprow{ip} = $data4[0]; 175 $iprow{ipcount} = $data4[1]; 176 $iprow{indent} = ' '; 156 177 # ip | count | s4list | added 157 $out .= " $data4[0] ($data4[1])<br>\n"; 158 $ipseen{$data4[0]} = 1; 159 } 160 $out .= " </div>\n"; 161 } 162 163 my $sqlalt = "select ip from iplist where ip << ?"; 164 my $sthalt = $dbh->prepare($sqlalt); 165 $sthalt->execute($block1); 166 my @newips; 167 while (my @data4 = $sthalt->fetchrow_array) { 168 push @newips, $data4[0] if !$ipseen{$data4[0]}; 178 push @iprows, \%iprow; 169 179 $ipseen{$data4[0]} = 1; 170 180 } 171 if ($#newips > -1) { 172 $out .= " <div class=iplist>\n"; 173 foreach (@newips) { 174 $out .= " $_ ($ipseen{$_})<br>\n"; 175 } 176 $out .= " </div>\n"; 177 } 178 # lvl 1 div close 179 $out .= " </div>\n"; 181 $tmpl1->param(iplist => \@iprows); 182 $tmpl1->param(subs => $lvl2out); 183 $lvl1out .= $tmpl1->output; 184 180 185 } 181 } else { 182 $sthiplist->execute($block0); 183 $out .= " <div class=iplist>\n"; 184 while (my @data4 = $sthiplist->fetchrow_array) { 186 } # sth1->rows 187 $sthiplist->execute($block0); 188 my @iprows; 189 while (my @data4 = $sthiplist->fetchrow_array) { 190 next if $ipseen{$data4[0]}; 191 my %iprow; 192 $iprow{ip} = $data4[0]; 193 $iprow{ipcount} = $data4[1]; 194 $iprow{indent} = ''; 185 195 # ip | count | s4list | added 186 $out .= " $data4[0] ($data4[1])<br>\n"; 187 $ipseen{$data4[0]} = 1; 188 } 189 $out .= " </div>\n"; 190 } 191 192 my $sqlalt = "select ip from iplist where ip << ?"; 193 my $sthalt = $dbh->prepare($sqlalt); 194 $sthalt->execute($block0); 195 my @newips; 196 while (my @data4 = $sthalt->fetchrow_array) { 197 push @newips, $data4[0] if (!$ipseen{$data4[0]}); 198 } 199 if ($#newips > -1) { 200 $out .= " <div class=iplist>\n"; 201 foreach (@newips) { 202 $out .= " $_<br>\n"; 203 } 204 $out .= " </div>\n"; 205 } 206 207 $out .= "</div>\n"; 208 } 209 210 return $out; 196 push @iprows, \%iprow; 197 $ipseen{$data4[0]} = 1; 198 } 199 $tmpl0->param(iplist => \@iprows); 200 $tmpl0->param(subs => $lvl1out); 201 } 202 203 return $tmpl0->output; 211 204 } # end browse() -
trunk/dnsbl/templates/dnsbl.css
r7 r19 76 76 width: 150px; 77 77 } 78 .inhere { 79 font-weight: bold; 80 }
Note:
See TracChangeset
for help on using the changeset viewer.