- Timestamp:
- 04/04/05 17:19:24 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/stable/cgi-bin/main.cgi
r209 r211 820 820 if ($webvar{alloctype} =~ /^.i$/) { 821 821 my ($base,undef) = split //, $webvar{alloctype}; # split into individual chars 822 my $sql;823 # Check for pools in Subury or North Bay if DSL or server pool. Anywhere else is824 # invalid and shouldn't be in the db in the first place.822 my ($sql,$city); 823 # Check for pools in Subury, North Bay, or Toronto if DSL or server pool. 824 # Anywhere else is invalid and shouldn't be in the db in the first place. 825 825 # ... aside from #^%#$%#@#^%^^!!!! legacy data. GRRR. 826 826 # Note that we want to retain the requested city to relate to customer info. 827 ##fixme This needs thought.828 ##SELECT DISTINCT pool, Count(*) FROM poolips where available='y' GROUP BY pool;829 827 if ($base =~ /^[ds]$/) { 830 $ sql = "select * from poolips where available='y' and".831 " type='$webvar{alloctype}' and (city='Sudbury' or city='North Bay' orcity='Toronto')";828 $city = "(allocations.city='Sudbury' or allocations.city='North Bay' or ". 829 "allocations.city='Toronto')"; 832 830 } else { 833 $sql = "select * from poolips where available='y' and". 834 " type='$webvar{alloctype}' and city='$webvar{pop}'"; 835 } 836 837 # Now that we know where we're looking, we can list the pools with free IPs. 838 $sth = $ip_dbh->prepare($sql); 831 $city = "allocations.city='$webvar{pop}'"; 832 } 833 834 # Ewww. But it works. 835 $sth = $ip_dbh->prepare("SELECT (SELECT city FROM allocations WHERE cidr=poolips.pool), ". 836 "poolips.pool, COUNT(*) FROM poolips,allocations WHERE poolips.available='y' AND ". 837 "poolips.pool=allocations.cidr AND $city AND poolips.type LIKE '".$base."_' ". 838 "GROUP BY pool"); 839 839 $sth->execute; 840 my %ipcount;841 840 my $optionlist; 842 841 while (my @data = $sth->fetchrow_array) { 843 $ipcount{$data[0]}++; 844 } 845 $sth = $ip_dbh->prepare("select city from allocations where cidr=?"); 846 foreach my $key (keys %ipcount) { 847 $sth->execute($key); 848 my @data = $sth->fetchrow_array; 849 $optionlist .= "<option value='$key'>$key [$ipcount{$key} free IP(s)] in $data[0]</option>\n"; 842 # city,pool cidr,free IP count 843 if ($data[2] > 0) { 844 $optionlist .= "<option value='$data[1]'>$data[1] [$data[2] free IP(s)] in $data[0]</option>\n"; 845 } 850 846 } 851 847 $cidr = "Single static IP"; … … 880 876 ##fixme 881 877 # This section needs serious Pondering. 882 # Pools of alltypes get assigned to the POP they're "routed from"878 # Pools of most types get assigned to the POP they're "routed from" 883 879 # This includes WAN blocks and other netblock "containers" 884 if ($webvar{alloctype} =~ /^.[pdc]$/) { 880 # This does NOT include cable pools. 881 if ($webvar{alloctype} =~ /^.[pc]$/) { 885 882 if (($webvar{city} !~ /^(Sudbury|North Bay|Toronto)$/) && ($webvar{alloctype} eq 'dp')) { 886 883 printError("You must chose Sudbury, North Bay, or Toronto for DSL pools.");
Note:
See TracChangeset
for help on using the changeset viewer.