Changeset 74 for trunk/cgi-bin/main.cgi
- Timestamp:
- 11/16/04 15:10:08 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/cgi-bin/main.cgi
r73 r74 734 734 my $count = 0; 735 735 while (my @data = $sth->fetchrow_array) { 736 # pool,ip,custid,city,ptype,available,notes,description 736 # pool,ip,custid,city,ptype,available,notes,description,circuitid 737 737 # If desc is null, make it not null. <g> 738 738 if ($data[7] eq '') { … … 933 933 $html =~ s|\$\$CITY\$\$|$webvar{city}|g; 934 934 $html =~ s|\$\$CUSTID\$\$|$webvar{custid}|g; 935 $html =~ s|\$\$CIRCID\$\$|$webvar{circid}|g; 935 936 $webvar{desc} = desanitize($webvar{desc}); 936 937 $webvar{notes} = desanitize($webvar{notes}); … … 976 977 977 978 $sth = $ip_dbh->prepare("update poolips set custid='$webvar{custid}',". 978 "city='$webvar{city}',available='n',description='$webvar{desc}'". 979 "city='$webvar{city}',available='n',description='$webvar{desc}',". 980 "circuitid='$webvar{circid}'". 979 981 " where ip='$cidr'"); 980 982 $sth->execute; … … 1028 1030 $sth = $ip_dbh->prepare("insert into allocations values ('$webvar{fullcidr}',". 1029 1031 "'$webvar{custid}','$webvar{alloctype}','$webvar{city}','$webvar{desc}',". 1030 "'$webvar{notes}',".$cidr->masklen." )");1032 "'$webvar{notes}',".$cidr->masklen.",'$webvar{circid}')"); 1031 1033 $sth->execute; 1032 1034 } # routing vs non-routing netblock … … 1094 1096 $sth = $ip_dbh->prepare("insert into allocations values ('$webvar{fullcidr}',". 1095 1097 "'$webvar{custid}','$webvar{alloctype}','$webvar{city}',". 1096 "'$webvar{desc}','$webvar{notes}',".$cidr->masklen." )");1098 "'$webvar{desc}','$webvar{notes}',".$cidr->masklen.",'$webvar{circid}')"); 1097 1099 $sth->execute; 1098 1100 } # done with netblock alloctype != rr … … 1117 1119 # have to insert all pool IPs into poolips table as "unallocated". 1118 1120 $sth = $ip_dbh->prepare("insert into poolips values ('$webvar{fullcidr}',". 1119 " ?, '6750400', '$webvar{city}', '$pooltype', 'y', '' )");1121 " ?, '6750400', '$webvar{city}', '$pooltype', 'y', '', '', '')"); 1120 1122 my @poolip_list = $cidr->hostenum; 1121 1123 for (my $i=1; $i<=$#poolip_list; $i++) { … … 1190 1192 # because I'm lazy, we'll try to make the SELECT's bring out identical)ish) data 1191 1193 if ($webvar{block} =~ /\/32$/) { 1192 $sql = "select ip,custid,ptype,city, description,notes from poolips where ip='$webvar{block}'";1194 $sql = "select ip,custid,ptype,city,circuitid,description,notes from poolips where ip='$webvar{block}'"; 1193 1195 } else { 1194 $sql = "select cidr,custid,type,city, description,notes from allocations where cidr='$webvar{block}'"1196 $sql = "select cidr,custid,type,city,circuitid,description,notes from allocations where cidr='$webvar{block}'" 1195 1197 } 1196 1198 … … 1243 1245 # These can be modified, although CustID changes may get ignored. 1244 1246 $html =~ s/\$\$CUSTID\$\$/$data[1]/g; 1245 $html =~ s/\$\$DESC\$\$/$data[4]/g; 1246 $html =~ s/\$\$NOTES\$\$/$data[5]/g; 1247 $html =~ s/\$\$TYPE\$\$/$data[2]/g; 1248 $html =~ s/\$\$CIRCID\$\$/$data[4]/g; 1249 $html =~ s/\$\$DESC\$\$/$data[5]/g; 1250 $html =~ s/\$\$NOTES\$\$/$data[6]/g; 1247 1251 1248 1252 print $html; … … 1267 1271 # Note the hack ( available='n' ) to work around "update" additions 1268 1272 # to static IP space. Eww. 1269 $sql = "update poolips set custid='$webvar{custid}', ".1270 " notes='$webvar{notes}',description='$webvar{desc}',available='n' ".1273 $sql = "update poolips set custid='$webvar{custid}',notes='$webvar{notes}',". 1274 "circuitid='$webvar{circid}',description='$webvar{desc}',available='n' ". 1271 1275 "where ip='$webvar{block}'"; 1272 1276 } else { 1273 1277 $sql = "update allocations set custid='$webvar{custid}',". 1274 1278 "description='$webvar{desc}',notes='$webvar{notes}',city='$webvar{city}',". 1275 "type='$webvar{alloctype}' where cidr='$webvar{block}'";1279 "type='$webvar{alloctype}',circuitid='$webvar{circid}' where cidr='$webvar{block}'"; 1276 1280 } 1277 1281 syslog "debug", $sql; … … 1298 1302 $html =~ s/\$\$TYPEFULL\$\$/$full_alloc_types{$webvar{alloctype}}/g; 1299 1303 $html =~ s/\$\$CUSTID\$\$/$webvar{custid}/g; 1304 $html =~ s/\$\$CIRCID\$\$/$webvar{circid}/g; 1300 1305 $html =~ s/\$\$DESC\$\$/$webvar{desc}/g; 1301 1306 $html =~ s/\$\$NOTES\$\$/$webvar{notes}/g; … … 1322 1327 } 1323 1328 1324 my ($cidr, $custid, $type, $city, $ desc, $notes, $alloctype);1329 my ($cidr, $custid, $type, $city, $circid, $desc, $notes, $alloctype); 1325 1330 1326 1331 if ($webvar{alloctype} eq 'rr') { … … 1336 1341 $custid = "N/A"; 1337 1342 $alloctype = $webvar{alloctype}; 1343 $circid = "N/A"; 1338 1344 $desc = "N/A"; 1339 1345 $notes = "N/A"; … … 1344 1350 $custid = "N/A"; 1345 1351 $alloctype = $webvar{alloctype}; 1352 $circid = "N/A"; 1346 1353 $desc = "N/A"; 1347 1354 $notes = "N/A"; … … 1349 1356 1350 1357 # Unassigning a static IP 1351 my $sth = $ip_dbh->prepare("select ip,custid,city,ptype,notes from poolips".1358 my $sth = $ip_dbh->prepare("select ip,custid,city,ptype,notes,circuitid from poolips". 1352 1359 " where ip='$webvar{block}'"); 1353 1360 $sth->execute(); 1354 1361 # croak $sth->errstr() if($sth->errstr()); 1355 1362 1356 $sth->bind_columns(\$cidr, \$custid, \$city, \$alloctype, \$notes );1363 $sth->bind_columns(\$cidr, \$custid, \$city, \$alloctype, \$notes, \$circid); 1357 1364 $sth->fetch() || croak $sth->errstr; 1358 1365 … … 1361 1368 } else { # done with alloctype=[cdsmw]i 1362 1369 1363 my $sth = $ip_dbh->prepare("select cidr,custid,type,city, description,notes from ".1370 my $sth = $ip_dbh->prepare("select cidr,custid,type,city,circuitid,description,notes from ". 1364 1371 "allocations where cidr='$webvar{block}'"); 1365 1372 $sth->execute(); 1366 1373 # croak $sth->errstr() if($sth->errstr()); 1367 1374 1368 $sth->bind_columns(\$cidr, \$custid, \$alloctype, \$city, \$ desc, \$notes);1369 $sth->fetch() || c roak$sth->errstr;1375 $sth->bind_columns(\$cidr, \$custid, \$alloctype, \$city, \$circid, \$desc, \$notes); 1376 $sth->fetch() || carp $sth->errstr; 1370 1377 } # end cases for different alloctypes 1371 1378 … … 1377 1384 $html =~ s|\$\$CITY\$\$|$city|g; 1378 1385 $html =~ s|\$\$CUSTID\$\$|$custid|g; 1386 $html =~ s|\$\$CIRCID\$\$|$circid|g; 1379 1387 $html =~ s|\$\$DESC\$\$|$desc|g; 1380 1388 $html =~ s|\$\$NOTES\$\$|$notes|g;
Note:
See TracChangeset
for help on using the changeset viewer.