Changeset 214 for trunk/cgi-bin/main.cgi
- Timestamp:
- 04/05/05 14:24:52 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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$/) {
Note:
See TracChangeset
for help on using the changeset viewer.