Index: trunk/cgi-bin/ipdb.psql
===================================================================
--- trunk/cgi-bin/ipdb.psql	(revision 87)
+++ trunk/cgi-bin/ipdb.psql	(revision 92)
@@ -5,5 +5,5 @@
 
 --
--- TOC Entry ID 18 (OID 16556)
+-- TOC Entry ID 22 (OID 16556)
 --
 -- Name: "plpgsql_call_handler" () Type: FUNCTION Owner: postgres
@@ -13,5 +13,5 @@
 
 --
--- TOC Entry ID 19 (OID 16557)
+-- TOC Entry ID 23 (OID 16557)
 --
 -- Name: plpgsql Type: PROCEDURAL LANGUAGE Owner: 
@@ -217,2 +217,48 @@
 GRANT ALL on "allocations" to "ipdb";
 
+--
+-- TOC Entry ID 18 (OID 92809)
+--
+-- Name: alloctypes Type: TABLE Owner: ipdb
+--
+
+CREATE TABLE "alloctypes" (
+	"type" character(2) DEFAULT '' NOT NULL,
+	"listname" character varying(40) DEFAULT '',
+	"dispname" character varying(40) DEFAULT '',
+	"listorder" integer DEFAULT 0,
+	Constraint "alloctypes_pkey" Primary Key ("type")
+);
+
+--
+-- TOC Entry ID 19 (OID 92809)
+--
+-- Name: alloctypes Type: ACL Owner: 
+--
+
+REVOKE ALL on "alloctypes" from PUBLIC;
+GRANT ALL on "alloctypes" to "kdeugau";
+GRANT ALL on "alloctypes" to "ipdb";
+
+--
+-- TOC Entry ID 20 (OID 93964)
+--
+-- Name: cities Type: TABLE Owner: ipdb
+--
+
+CREATE TABLE "cities" (
+	"city" character varying(30) DEFAULT '' NOT NULL,
+	"routing" character(1) DEFAULT 'n' NOT NULL,
+	Constraint "cities_pkey" Primary Key ("city")
+);
+
+--
+-- TOC Entry ID 21 (OID 93964)
+--
+-- Name: cities Type: ACL Owner: 
+--
+
+REVOKE ALL on "cities" from PUBLIC;
+GRANT ALL on "cities" to "kdeugau";
+GRANT ALL on "cities" to "ipdb";
+
Index: trunk/cgi-bin/main.cgi
===================================================================
--- trunk/cgi-bin/main.cgi	(revision 87)
+++ trunk/cgi-bin/main.cgi	(revision 92)
@@ -68,4 +68,6 @@
 # Other global variables
 my @masterblocks;
+my @citylist;
+my @poplist;
 my %allocated;	# Count for allocated blocks in a master block
 my %free;	# Count for free blocks (routed and unrouted) in a master block
@@ -77,8 +79,9 @@
 # Use the connectDB function, otherwise we end up confusing ourselves
 my $ip_dbh = connectDB;
+my $sth;
 
 # Slurp up the master block list - we need this several places
 # While we're at it, initialize the related hashes.
-my $sth = $ip_dbh->prepare("select * from masterblocks order by cidr");
+$sth = $ip_dbh->prepare("select * from masterblocks order by cidr");
 $sth->execute;
 for (my $i=0; my @data = $sth->fetchrow_array(); $i++) {
@@ -91,4 +94,15 @@
 }
 
+# Initialize the city and poplist arrays
+$sth = $ip_dbh->prepare("select * from cities order by city");
+$sth->execute;
+my $i = 0;
+my $j = 0;
+while (my @data = $sth->fetchrow_array) {
+  $citylist[$i++] = $data[0];
+  if ($data[1] eq 'y') {
+    $poplist[$j++] = $data[0];
+  }
+}
 
 
@@ -778,4 +792,5 @@
 	or croak "Could not open assign.html: $!";
     $html = join('',<HTML>);
+    close HTML;
     my $masterlist = "<select name=allocfrom><option selected>-</option>\n";
     foreach my $master (@masterblocks) {
@@ -784,6 +799,15 @@
     $masterlist .= "</select>\n";
     $html =~ s|\$\$MASTERLIST\$\$|$masterlist|g;
-    close HTML;
-  }
+    my $pops = '';
+    foreach my $pop (@poplist) {
+      $pops .= "<option>$pop</option>\n";
+    }
+    $html =~ s|\$\$POPLIST\$\$|$pops|g;
+  }
+  my $cities = '';
+  foreach my $city (@citylist) {
+    $cities .= "<option>$city</option>\n";
+  }
+  $html =~ s|\$\$ALLCITIES\$\$|$cities|g;
 
   print $html;
@@ -940,6 +964,6 @@
   $html =~ s|\$\$CIRCID\$\$|$webvar{circid}|g;
   $webvar{desc} = desanitize($webvar{desc});
+  $html =~ s|\$\$DESC\$\$|$webvar{desc}|g;
   $webvar{notes} = desanitize($webvar{notes});
-  $html =~ s|\$\$DESC\$\$|$webvar{desc}|g;
   $html =~ s|\$\$NOTES\$\$|$webvar{notes}|g;
   $html =~ s|\$\$ACTION\$\$|insert|g;
@@ -1303,10 +1327,14 @@
 
   $html =~ s/\$\$BLOCK\$\$/$webvar{block}/g;
+  $webvar{city} = desanitize($webvar{city});
   $html =~ s/\$\$CITY\$\$/$webvar{city}/g;
   $html =~ s/\$\$ALLOCTYPE\$\$/$webvar{alloctype}/g;
   $html =~ s/\$\$TYPEFULL\$\$/$full_alloc_types{$webvar{alloctype}}/g;
   $html =~ s/\$\$CUSTID\$\$/$webvar{custid}/g;
+  $webvar{circid} = desanitize($webvar{circid});
   $html =~ s/\$\$CIRCID\$\$/$webvar{circid}/g;
+  $webvar{desc} = desanitize($webvar{desc});
   $html =~ s/\$\$DESC\$\$/$webvar{desc}/g;
+  $webvar{notes} = desanitize($webvar{notes});
   $html =~ s/\$\$NOTES\$\$/$webvar{notes}/g;
 
