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


Ignore:
Timestamp:
11/30/04 15:42:30 (20 years ago)
Author:
Kris Deugau
Message:

/trunk

Port updates and bugfixes from /branches/stable r87:91 back
into devel tree

File:
1 edited

Legend:

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

    r87 r92  
    6868# Other global variables
    6969my @masterblocks;
     70my @citylist;
     71my @poplist;
    7072my %allocated;  # Count for allocated blocks in a master block
    7173my %free;       # Count for free blocks (routed and unrouted) in a master block
     
    7779# Use the connectDB function, otherwise we end up confusing ourselves
    7880my $ip_dbh = connectDB;
     81my $sth;
    7982
    8083# Slurp up the master block list - we need this several places
    8184# While we're at it, initialize the related hashes.
    82 my $sth = $ip_dbh->prepare("select * from masterblocks order by cidr");
     85$sth = $ip_dbh->prepare("select * from masterblocks order by cidr");
    8386$sth->execute;
    8487for (my $i=0; my @data = $sth->fetchrow_array(); $i++) {
     
    9194}
    9295
     96# Initialize the city and poplist arrays
     97$sth = $ip_dbh->prepare("select * from cities order by city");
     98$sth->execute;
     99my $i = 0;
     100my $j = 0;
     101while (my @data = $sth->fetchrow_array) {
     102  $citylist[$i++] = $data[0];
     103  if ($data[1] eq 'y') {
     104    $poplist[$j++] = $data[0];
     105  }
     106}
    93107
    94108
     
    778792        or croak "Could not open assign.html: $!";
    779793    $html = join('',<HTML>);
     794    close HTML;
    780795    my $masterlist = "<select name=allocfrom><option selected>-</option>\n";
    781796    foreach my $master (@masterblocks) {
     
    784799    $masterlist .= "</select>\n";
    785800    $html =~ s|\$\$MASTERLIST\$\$|$masterlist|g;
    786     close HTML;
    787   }
     801    my $pops = '';
     802    foreach my $pop (@poplist) {
     803      $pops .= "<option>$pop</option>\n";
     804    }
     805    $html =~ s|\$\$POPLIST\$\$|$pops|g;
     806  }
     807  my $cities = '';
     808  foreach my $city (@citylist) {
     809    $cities .= "<option>$city</option>\n";
     810  }
     811  $html =~ s|\$\$ALLCITIES\$\$|$cities|g;
    788812
    789813  print $html;
     
    940964  $html =~ s|\$\$CIRCID\$\$|$webvar{circid}|g;
    941965  $webvar{desc} = desanitize($webvar{desc});
     966  $html =~ s|\$\$DESC\$\$|$webvar{desc}|g;
    942967  $webvar{notes} = desanitize($webvar{notes});
    943   $html =~ s|\$\$DESC\$\$|$webvar{desc}|g;
    944968  $html =~ s|\$\$NOTES\$\$|$webvar{notes}|g;
    945969  $html =~ s|\$\$ACTION\$\$|insert|g;
     
    13031327
    13041328  $html =~ s/\$\$BLOCK\$\$/$webvar{block}/g;
     1329  $webvar{city} = desanitize($webvar{city});
    13051330  $html =~ s/\$\$CITY\$\$/$webvar{city}/g;
    13061331  $html =~ s/\$\$ALLOCTYPE\$\$/$webvar{alloctype}/g;
    13071332  $html =~ s/\$\$TYPEFULL\$\$/$full_alloc_types{$webvar{alloctype}}/g;
    13081333  $html =~ s/\$\$CUSTID\$\$/$webvar{custid}/g;
     1334  $webvar{circid} = desanitize($webvar{circid});
    13091335  $html =~ s/\$\$CIRCID\$\$/$webvar{circid}/g;
     1336  $webvar{desc} = desanitize($webvar{desc});
    13101337  $html =~ s/\$\$DESC\$\$/$webvar{desc}/g;
     1338  $webvar{notes} = desanitize($webvar{notes});
    13111339  $html =~ s/\$\$NOTES\$\$/$webvar{notes}/g;
    13121340
Note: See TracChangeset for help on using the changeset viewer.