Changeset 5 for trunk


Ignore:
Timestamp:
09/10/09 12:48:42 (15 years ago)
Author:
Kris Deugau
Message:

/trunk/dnsbl

Tweak IP-adding script, template, and the DNSBL::ipexists to show how
many times an IP has been reported

Location:
trunk/dnsbl
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/dnsbl/DNSBL.pm

    r4 r5  
    123123}
    124124
    125 # return true if the IP has been reported
     125
     126## DNSBL::ipexists()
     127# return report count if the IP has been reported, otherwise return undef
    126128sub ipexists {
    127129  my $self = shift;
    128130  my $ip = shift;
    129   my $sth = $dbh->prepare("SELECT count(*) FROM iplist WHERE ip=?");
     131  my $sth = $dbh->prepare("SELECT count FROM iplist WHERE ip=?");
    130132  $sth->execute($ip);
    131133  my ($ret) = $sth->fetchrow_array();
    132134  return $ret;
    133 }
     135} # end ipexists()
    134136
    135137
  • trunk/dnsbl/dnsbl.cgi

    r2 r5  
    3737if ($webvar{page} eq 'report') {
    3838  $page->param(ip => $webvar{ip});
     39  my $count = $dnsbl->ipexists($webvar{ip});
     40  $page->param(nreports => $count) if $count;
    3941  for (my $i=0; $i<3; $i++) {
    4042    my ($block,$org) = $dnsbl->getcontainer($webvar{ip},$i);
  • trunk/dnsbl/templates/report.tmpl

    r2 r5  
    55<body>
    66<table border=1><tr><td>
    7 adding <TMPL_VAR NAME=ip></td></tr>
     7<TMPL_VAR NAME=ip><TMPL_IF NAME=nreports></td><td>(reported <TMPL_VAR NAME=nreports> time(s)) <a href="/">Back</a></TMPL_IF></td></tr>
    88<form action="dnsbl.cgi">
    99<input type=hidden name=page value=dbreport>
Note: See TracChangeset for help on using the changeset viewer.