- Timestamp:
- 05/11/10 17:06:26 (15 years ago)
- Location:
- trunk/cgi-bin
- Files:
-
- 2 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/cgi-bin/admin.cgi
r398 r400 18 18 use CommonWeb qw(:ALL); 19 19 use MyIPDB; 20 use CustIDCK; 20 21 #use POSIX qw(ceil); 21 22 use NetAddr::IP; … … 134 135 my $custid = $data[0]; 135 136 if ($custid eq '') { 137 if ($webvar{custid} !~ /^(?:\d{10}|\d{7}|STAFF)(?:-\d\d?)?$/) { 138 # Force uppercase for now... 139 $webvar{custid} =~ tr/a-z/A-Z/; 140 # Crosscheck with billing. 141 my $status = CustIDCK->custid_exist($webvar{custid}); 142 if ($CustIDCK::Error) { 143 printError("Error verifying customer ID: ".$CustIDCK::ErrMsg); 144 return; 145 } 146 if (!$status) { 147 printError("Customer ID not valid. Make sure the Customer ID ". 148 "is correct.<br>\nUse STAFF for staff static IPs, and 6750400 for any other ". 149 "non-customer assignments."); 150 return; 151 } 152 } 136 153 # Type that doesn't have a default custid 137 154 $custid = $webvar{custid}; 138 155 } 139 ##fixme Check billing DB here140 156 141 157 my $cidr = new NetAddr::IP $webvar{cidr}; … … 506 522 # 507 523 524 print qq(<hr><a href="/ip/">Back</a> to main interface</a>\n); 508 525 509 526 printFooter; -
trunk/cgi-bin/checkcusts.pl
r123 r400 7 7 # Last update by $Author$ 8 8 ### 9 # Copyright (C) 2004 Kris Deugau <kdeugau@vianet.ca>9 # Copyright (C) 2004-2006 Kris Deugau 10 10 11 11 use DBI; 12 use IPDB qw(:ALL);12 use IPDB 2.0 qw(:ALL); 13 13 14 14 # We'll be hosing the server with several thousand queries. We … … 25 25 print "Content-type: text/plain\n\n"; 26 26 27 $dbh = connectDB;27 ($dbh,$errstr) = connectDB("ipdb", "ipdb", "ipdbpwd"); 28 28 $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; 32 while (@data = $sth->fetchrow_array) { 33 push @def_custids, $data[0]; 34 } 29 35 $sth = $dbh->prepare("select cidr,custid from searchme where not (custid='6750400') ". 30 36 "and not (custid='STAFF') order by cidr"); 37 #$sth = $dbh->prepare("select cidr,custid from searchme order by cidr"); 31 38 $sth->execute; 32 39 … … 35 42 $count = $bad = 0; 36 43 while (@data = $sth->fetchrow_array) { 37 $count++;38 44 $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)) { 40 47 # no-op. we ignore these. 41 48 } else { 49 $count++; 42 50 $IDS->execute($data[1]); 43 51 $hr = $IDS->fetchrow_hashref(); -
trunk/cgi-bin/main.cgi
r397 r400 15 15 use CommonWeb qw(:ALL); 16 16 use MyIPDB; 17 use CustIDCK; 17 18 use POSIX qw(ceil); 18 19 use NetAddr::IP; … … 943 944 return; 944 945 } 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"; 950 965 } else { 951 966 # New! Improved! And now Loaded From The Database!! … … 967 982 } else { 968 983 $flag = 'n'; 969 if ($webvar{alloctype} =~ /[wp][cr]| d[pi]/) {984 if ($webvar{alloctype} =~ /[wp][cr]|[ds][pi]/) { 970 985 # 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} =~ /^-$/) { 974 989 $flag = 'to route the block from/through'; 975 990 }
Note:
See TracChangeset
for help on using the changeset viewer.