Ignore:
Timestamp:
05/11/10 17:06:26 (14 years ago)
Author:
Kris Deugau
Message:

/trunk

Merge addition of CustIDCK.pm from r56 - proprietary info this contained
was stripped during repo history conversion and it makes a good base for
providing data validation hooks.
Also merge all updates and related additions since.
See #13.

File:
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/cgi-bin/checkcusts.pl

    r123 r400  
    77# Last update by $Author$
    88###
    9 # Copyright (C) 2004 Kris Deugau <kdeugau@vianet.ca>
     9# Copyright (C) 2004-2006 Kris Deugau
    1010
    1111use DBI;
    12 use IPDB qw(:ALL);
     12use IPDB 2.0 qw(:ALL);
    1313
    1414# We'll be hosing the server with several thousand queries.  We
     
    2525print "Content-type: text/plain\n\n";
    2626
    27 $dbh = connectDB;
     27($dbh,$errstr) = connectDB("ipdb", "ipdb", "ipdbpwd");
    2828$IDH = DBI->connect ("DBI:Pg:host=billing;dbname=custids", "cidcheck", "c1dch4ck");
     29
     30$sth = $dbh->prepare("select distinct def_custid from alloctypes where listorder >=40");
     31$sth->execute;
     32while (@data = $sth->fetchrow_array) {
     33  push @def_custids, $data[0];
     34}
    2935$sth = $dbh->prepare("select cidr,custid from searchme where not (custid='6750400') ".
    3036        "and not (custid='STAFF') order by cidr");
     37#$sth = $dbh->prepare("select cidr,custid from searchme order by cidr");
    3138$sth->execute;
    3239
     
    3542$count = $bad = 0;
    3643while (@data = $sth->fetchrow_array) {
    37   $count++;
    3844  $cidr = new NetAddr::IP $data[0];
    39   if ($cidr->within($priv1) or $cidr->within($priv2) or $cidr->within($priv3)) {
     45  if ($cidr->within($priv1) or $cidr->within($priv2) or $cidr->within($priv3) or
     46        (grep /$data[1]/, @def_custids)) {
    4047    # no-op.  we ignore these.
    4148  } else {
     49    $count++;
    4250    $IDS->execute($data[1]);
    4351    $hr = $IDS->fetchrow_hashref();
Note: See TracChangeset for help on using the changeset viewer.