Changeset 400 for trunk/cgi-bin/main.cgi


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 edited

Legend:

Unmodified
Added
Removed
  • trunk/cgi-bin/main.cgi

    r397 r400  
    1515use CommonWeb qw(:ALL);
    1616use MyIPDB;
     17use CustIDCK;
    1718use POSIX qw(ceil);
    1819use NetAddr::IP;
     
    943944      return;
    944945    }
    945     if ($webvar{custid} !~ /^(?:\d{5,10}|STAFF|TEMP)(?:-\d\d?)?$/) {
    946       printError("Please enter a valid customer ID- this must be a 7- or 10-digit number, or STAFF for static IPs for staff.");
    947       return;
    948     }
    949     print "<!-- [ In validateInput().  Insert customer ID cross-check here. ] -->\n";
     946    if ($webvar{custid} !~ /^(?:\d{10}|\d{7}|STAFF)(?:-\d\d?)?$/) {
     947      # Force uppercase for now...
     948      $webvar{custid} =~ tr/a-z/A-Z/;
     949      # Crosscheck with billing.
     950      my $status = CustIDCK->custid_exist($webvar{custid});
     951      if ($CustIDCK::Error) {
     952        printError("Error verifying customer ID: ".$CustIDCK::ErrMsg);
     953        return;
     954      }
     955      if (!$status) {
     956        printError("Customer ID not valid.  Make sure the Customer ID ".
     957          "is correct.<br>\nUse STAFF for staff static IPs, and 6750400 for any other ".
     958          "non-customer assignments.");
     959        return;
     960      }
     961#"Please enter a valid customer ID- this must be a 7- or 10-digit number, or STAFF for
     962#static IPs for staff.");
     963    }
     964#    print "<!-- [ In validateInput().  Insert customer ID cross-check here. ] -->\n";
    950965  } else {
    951966    # New!  Improved!  And now Loaded From The Database!!
     
    967982  } else {
    968983    $flag = 'n';
    969     if ($webvar{alloctype} =~ /[wp][cr]|d[pi]/) {
     984    if ($webvar{alloctype} =~ /[wp][cr]|[ds][pi]/) {
    970985      # Set this forcibly rather than messing around elsewhere.  Yes, this *is* a hack.  PTHBTT!!
    971       # Match CORE/WAN types (wc, wr, pc, pr), DSL pool and IP (dp, di).
    972       $webvar{pop} = "Sudbury";
    973     } elsif ($webvar{pop} =~ /^-$/) {
     986      $webvar{pop} = 'Sudbury';
     987    }
     988    if ($webvar{pop} =~ /^-$/) {
    974989      $flag = 'to route the block from/through';
    975990    }
Note: See TracChangeset for help on using the changeset viewer.