- Timestamp:
- 04/05/05 14:24:52 (20 years ago)
- Location:
- trunk/cgi-bin
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/cgi-bin/admin.cgi
r199 r214 33 33 } 34 34 35 if ($authuser !~ /^(kdeugau|jodyh| __temptest)$/) {35 if ($authuser !~ /^(kdeugau|jodyh|jipp)$/) { 36 36 print "Content-Type: text/html\n\n". 37 37 "<html><head><title>Access denied</title></head><body>\n". -
trunk/cgi-bin/consistency-check.pl
r190 r214 14 14 use NetAddr::IP; 15 15 16 print "Content-type: text/plain\n\n"; 17 16 18 ($dbh,$errstr) = connectDB_My; 17 19 … … 141 143 print " Gap from $cur to end of master at $master\n"; 142 144 } 145 $master++; 143 146 print " done $master.\n"; 144 147 } … … 176 179 "from allocations where cidr <<= '$container' and type like '_r') ". 177 180 "union (select network(cidr) as net, broadcast(cidr) as bcast ". 178 "from freeblocks where cidr <<= '$container' and routed='w') order by net"); 181 "from freeblocks where cidr <<= '$container' and not (routed='y' or routed='n')) ". 182 "order by net"); 179 183 $sth->execute; 180 184 … … 207 211 print " Gap from $cur to end of container at $container\n"; 208 212 } 213 $container++; 209 214 print " done $container.\n"; 210 215 … … 215 220 print "Checking for correctness on 'defined' CustIDs:\n"; 216 221 # New check: Make sure "defined" CustIDs are correct. 217 $sth = $dbh->prepare("select cidr,type,custid from allocations where not type='cn'order by cidr");222 $sth = $dbh->prepare("select cidr,type,custid from allocations where not (type='cn' or type like '_r') order by cidr"); 218 223 $sth->execute; 219 224 while (@data = $sth->fetchrow_array) { -
trunk/cgi-bin/main.cgi
r199 r214 171 171 print qq(<div align=right style="position: absolute; right: 30px;">). 172 172 qq(<a href="/ip/cgi-bin/admin.cgi">Admin tools</a></div><br>\n) 173 if $authuser =~ /kdeugau|jodyh /;173 if $authuser =~ /kdeugau|jodyh|jipp/; 174 174 175 175 # We print the footer here, so we don't have to do it elsewhere. … … 815 815 if ($webvar{alloctype} =~ /^.i$/) { 816 816 my ($base,undef) = split //, $webvar{alloctype}; # split into individual chars 817 my $sql;818 # Check for pools in Subury or North Bay if DSL or server pool. Anywhere else is819 # invalid and shouldn't be in the db in the first place.817 my ($sql,$city); 818 # Check for pools in Subury, North Bay, or Toronto if DSL or server pool. 819 # Anywhere else is invalid and shouldn't be in the db in the first place. 820 820 # ... aside from #^%#$%#@#^%^^!!!! legacy data. GRRR. 821 821 # Note that we want to retain the requested city to relate to customer info. 822 ##fixme This needs thought.823 ##SELECT DISTINCT pool, Count(*) FROM poolips where available='y' GROUP BY pool;824 822 if ($base =~ /^[ds]$/) { 825 $ sql = "select * from poolips where available='y' and".826 " type='$webvar{alloctype}' and (city='Sudbury' or city='North Bay')";823 $city = "(allocations.city='Sudbury' or allocations.city='North Bay' or ". 824 "allocations.city='Toronto')"; 827 825 } else { 828 $sql = "select * from poolips where available='y' and". 829 " type='$webvar{alloctype}' and city='$webvar{pop}'"; 830 } 831 832 # Now that we know where we're looking, we can list the pools with free IPs. 833 $sth = $ip_dbh->prepare($sql); 826 $city = "allocations.city='$webvar{pop}'"; 827 } 828 829 # Ewww. But it works. 830 $sth = $ip_dbh->prepare("SELECT (SELECT city FROM allocations WHERE cidr=poolips.pool), ". 831 "poolips.pool, COUNT(*) FROM poolips,allocations WHERE poolips.available='y' AND ". 832 "poolips.pool=allocations.cidr AND $city AND poolips.type LIKE '".$base."_' ". 833 "GROUP BY pool"); 834 834 $sth->execute; 835 my %ipcount;836 835 my $optionlist; 837 836 while (my @data = $sth->fetchrow_array) { 838 $ipcount{$data[0]}++; 839 } 840 $sth = $ip_dbh->prepare("select city from allocations where cidr=?"); 841 foreach my $key (keys %ipcount) { 842 $sth->execute($key); 843 my @data = $sth->fetchrow_array; 844 $optionlist .= "<option value='$key'>$key [$ipcount{$key} free IP(s)] in $data[0]</option>\n"; 837 # city,pool cidr,free IP count 838 if ($data[2] > 0) { 839 $optionlist .= "<option value='$data[1]'>$data[1] [$data[2] free IP(s)] in $data[0]</option>\n"; 840 } 845 841 } 846 842 $cidr = "Single static IP"; … … 875 871 ##fixme 876 872 # This section needs serious Pondering. 877 # Pools of alltypes get assigned to the POP they're "routed from"873 # Pools of most types get assigned to the POP they're "routed from" 878 874 # This includes WAN blocks and other netblock "containers" 879 if ($webvar{alloctype} =~ /^.[pdc]$/) { 880 if (($webvar{city} !~ /^(Sudbury|North Bay)$/) && ($webvar{alloctype} eq 'dp')) { 881 printError("You must chose Sudbury or North Bay for DSL pools."); 875 # This does NOT include cable pools. 876 if ($webvar{alloctype} =~ /^.[pc]$/) { 877 if (($webvar{city} !~ /^(Sudbury|North Bay|Toronto)$/) && ($webvar{alloctype} eq 'dp')) { 878 printError("You must chose Sudbury, North Bay, or Toronto for DSL pools."); 882 879 return; 883 880 } … … 976 973 print qq(<div class="center"><div class="heading">The IP $msg has been allocated to customer $webvar{custid}</div></div>); 977 974 # Notify tech@example.com 978 mailNotify('tech@example.com'," $disp_alloctypes{$webvar{alloctype}} allocation",975 mailNotify('tech@example.com',"ADDED: $disp_alloctypes{$webvar{alloctype}} allocation", 979 976 "$disp_alloctypes{$webvar{alloctype}} $msg allocated to customer $webvar{custid}\n". 980 977 "Description: $webvar{desc}\n\nAllocated by: $authuser\n"); … … 1015 1012 # CustID check 1016 1013 # We have different handling for customer allocations and "internal" or "our" allocations 1017 if ($ webvar{alloctype} =~ /^(cn|.i)$/) {1014 if ($def_custids{$webvar{alloctype}} eq '') { 1018 1015 if (!$webvar{custid}) { 1019 1016 printError("Please enter a customer ID."); … … 1294 1291 print "<div class=heading align=center>Success! $webvar{block} deallocated.</div>\n"; 1295 1292 syslog "notice", "$authuser deallocated '$webvar{alloctype}'-type netblock $webvar{block}"; 1293 # Notify tech@ when a block/IP is deallocated 1294 mailNotify('tech@example.com',"REMOVED: $disp_alloctypes{$webvar{alloctype}} $webvar{block}", 1295 "$disp_alloctypes{$webvar{alloctype}} $webvar{block} deallocated by $authuser\n"); 1296 1296 } else { 1297 1297 if ($webvar{alloctype} =~ /^.i$/) { -
trunk/cgi-bin/newcity.cgi
r142 r214 48 48 if ($sth->err) { 49 49 print "Error adding city to database: ".$sth->errstr; 50 mailNotify('kdeugau@vianet.ca',"IPDB city add failure",$sth->errstr); 50 mailNotify('kdeugau@vianet.ca',"IPDB city add failure", 51 "$authuser could not add city '$webvar{city}' to database: ".$sth->errstr); 51 52 syslog "err", "$authuser could not add city '$webvar{city}' to database: ".$sth->errstr; 52 53 } else {
Note:
See TracChangeset
for help on using the changeset viewer.