Changeset 485


Ignore:
Timestamp:
Sep 23, 2010, 12:51:55 AM (11 years ago)
Author:
Kris Deugau
Message:

/trunk

Convert pool-IP inserts to use DBI ? substitution on city. See #34.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/cgi-bin/IPDB.pm

    r462 r485  
    576576    # have to insert all pool IPs into poolips table as "unallocated".
    577577    $sth = $dbh->prepare("insert into poolips (pool,ip,custid,city,type)".
    578         " values ('$pool', ?, '$defcustid', '$city', '$type')");
     578        " values ('$pool', ?, '$defcustid', ?, '$type')");
    579579    my @poolip_list = $pool->hostenum;
    580580    if ($class eq 'all') { # (DSL-ish block - *all* IPs available
    581581      if ($pool->addr !~ /\.0$/) {      # .0 causes weirdness.
    582         $sth->execute($pool->addr);
     582        $sth->execute($pool->addr, $city);
    583583      }
    584584      for (my $i=0; $i<=$#poolip_list; $i++) {
    585         $sth->execute($poolip_list[$i]->addr);
     585        $sth->execute($poolip_list[$i]->addr, $city);
    586586      }
    587587      $pool--;
    588588      if ($pool->addr !~ /\.255$/) {    # .255 can cause weirdness.
    589         $sth->execute($pool->addr);
     589        $sth->execute($pool->addr, $city);
    590590      }
    591591    } else { # (real netblock)
    592592      for (my $i=1; $i<=$#poolip_list; $i++) {
    593         $sth->execute($poolip_list[$i]->addr);
     593        $sth->execute($poolip_list[$i]->addr, $city);
    594594      }
    595595    }
    596596  };
    597597  if ($@) {
    598     $msg = "'".$sth->errstr."'";
     598    $msg = $@." '".$sth->errstr."'";
    599599    eval { $dbh->rollback; };
    600600    return ('FAIL',$msg);
Note: See TracChangeset for help on using the changeset viewer.