Changeset 75 for branches/stable/cgi-bin/main.cgi
- Timestamp:
- 11/16/04 15:24:12 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/stable/cgi-bin/main.cgi
r71 r75 735 735 my $count = 0; 736 736 while (my @data = $sth->fetchrow_array) { 737 # pool,ip,custid,city,ptype,available,notes,description 737 # pool,ip,custid,city,ptype,available,notes,description,circuitid 738 738 # If desc is null, make it not null. <g> 739 739 if ($data[7] eq '') { … … 934 934 $html =~ s|\$\$CITY\$\$|$webvar{city}|g; 935 935 $html =~ s|\$\$CUSTID\$\$|$webvar{custid}|g; 936 $html =~ s|\$\$CIRCID\$\$|$webvar{circid}|g; 936 937 $webvar{desc} = desanitize($webvar{desc}); 937 938 $webvar{notes} = desanitize($webvar{notes}); … … 977 978 978 979 $sth = $ip_dbh->prepare("update poolips set custid='$webvar{custid}',". 979 "city='$webvar{city}',available='n',description='$webvar{desc}'". 980 "city='$webvar{city}',available='n',description='$webvar{desc}',". 981 "circuitid='$webvar{circid}'". 980 982 " where ip='$cidr'"); 981 983 $sth->execute; … … 1029 1031 $sth = $ip_dbh->prepare("insert into allocations values ('$webvar{fullcidr}',". 1030 1032 "'$webvar{custid}','$webvar{alloctype}','$webvar{city}','$webvar{desc}',". 1031 "'$webvar{notes}',".$cidr->masklen." )");1033 "'$webvar{notes}',".$cidr->masklen.",'$webvar{circid}')"); 1032 1034 $sth->execute; 1033 1035 } # routing vs non-routing netblock … … 1095 1097 $sth = $ip_dbh->prepare("insert into allocations values ('$webvar{fullcidr}',". 1096 1098 "'$webvar{custid}','$webvar{alloctype}','$webvar{city}',". 1097 "'$webvar{desc}','$webvar{notes}',".$cidr->masklen." )");1099 "'$webvar{desc}','$webvar{notes}',".$cidr->masklen.",'$webvar{circid}')"); 1098 1100 $sth->execute; 1099 1101 } # done with netblock alloctype != rr … … 1118 1120 # have to insert all pool IPs into poolips table as "unallocated". 1119 1121 $sth = $ip_dbh->prepare("insert into poolips values ('$webvar{fullcidr}',". 1120 " ?, '6750400', '$webvar{city}', '$pooltype', 'y', '' )");1122 " ?, '6750400', '$webvar{city}', '$pooltype', 'y', '', '', '')"); 1121 1123 my @poolip_list = $cidr->hostenum; 1122 1124 for (my $i=1; $i<=$#poolip_list; $i++) { … … 1205 1207 # because I'm lazy, we'll try to make the SELECT's bring out identical)ish) data 1206 1208 if ($webvar{block} =~ /\/32$/) { 1207 $sql = "select ip,custid,ptype,city, description,notes from poolips where ip='$webvar{block}'";1209 $sql = "select ip,custid,ptype,city,circuitid,description,notes from poolips where ip='$webvar{block}'"; 1208 1210 } else { 1209 $sql = "select cidr,custid,type,city, description,notes from allocations where cidr='$webvar{block}'"1211 $sql = "select cidr,custid,type,city,circuitid,description,notes from allocations where cidr='$webvar{block}'" 1210 1212 } 1211 1213 … … 1258 1260 # These can be modified, although CustID changes may get ignored. 1259 1261 $html =~ s/\$\$CUSTID\$\$/$data[1]/g; 1260 $html =~ s/\$\$DESC\$\$/$data[4]/g; 1261 $html =~ s/\$\$NOTES\$\$/$data[5]/g; 1262 $html =~ s/\$\$TYPE\$\$/$data[2]/g; 1263 $html =~ s/\$\$CIRCID\$\$/$data[4]/g; 1264 $html =~ s/\$\$DESC\$\$/$data[5]/g; 1265 $html =~ s/\$\$NOTES\$\$/$data[6]/g; 1262 1266 1263 1267 print $html; … … 1280 1284 my $sql; 1281 1285 if (my $pooltype = ($webvar{alloctype} =~ /^([cdms])i$/) ) { 1282 $sql = "update poolips set custid='$webvar{custid}', ".1283 " notes='$webvar{notes}',description='$webvar{desc}' ".1286 $sql = "update poolips set custid='$webvar{custid}',notes='$webvar{notes}',". 1287 "circuitid='$webvar{circid}',description='$webvar{desc}' ". 1284 1288 "where ip='$webvar{block}'"; 1285 1289 } else { 1286 1290 $sql = "update allocations set custid='$webvar{custid}',". 1287 1291 "description='$webvar{desc}',notes='$webvar{notes}',city='$webvar{city}',". 1288 "type='$webvar{alloctype}' where cidr='$webvar{block}'";1292 "type='$webvar{alloctype}',circuitid='$webvar{circid}' where cidr='$webvar{block}'"; 1289 1293 } 1290 1294 syslog "debug", $sql; … … 1311 1315 $html =~ s/\$\$TYPEFULL\$\$/$full_alloc_types{$webvar{alloctype}}/g; 1312 1316 $html =~ s/\$\$CUSTID\$\$/$webvar{custid}/g; 1317 $html =~ s/\$\$CIRCID\$\$/$webvar{circid}/g; 1313 1318 $html =~ s/\$\$DESC\$\$/$webvar{desc}/g; 1314 1319 $html =~ s/\$\$NOTES\$\$/$webvar{notes}/g; … … 1335 1340 } 1336 1341 1337 my ($cidr, $custid, $type, $city, $ desc, $notes, $alloctype);1342 my ($cidr, $custid, $type, $city, $circid, $desc, $notes, $alloctype); 1338 1343 1339 1344 if ($webvar{alloctype} eq 'rr') { … … 1349 1354 $custid = "N/A"; 1350 1355 $alloctype = $webvar{alloctype}; 1356 $circid = "N/A"; 1351 1357 $desc = "N/A"; 1352 1358 $notes = "N/A"; … … 1357 1363 $custid = "N/A"; 1358 1364 $alloctype = $webvar{alloctype}; 1365 $circid = "N/A"; 1359 1366 $desc = "N/A"; 1360 1367 $notes = "N/A"; … … 1362 1369 1363 1370 # Unassigning a static IP 1364 my $sth = $ip_dbh->prepare("select ip,custid,city,ptype,notes from poolips".1371 my $sth = $ip_dbh->prepare("select ip,custid,city,ptype,notes,circuitid from poolips". 1365 1372 " where ip='$webvar{block}'"); 1366 1373 $sth->execute(); 1367 1374 # croak $sth->errstr() if($sth->errstr()); 1368 1375 1369 $sth->bind_columns(\$cidr, \$custid, \$city, \$alloctype, \$notes );1376 $sth->bind_columns(\$cidr, \$custid, \$city, \$alloctype, \$notes, \$circid); 1370 1377 $sth->fetch() || croak $sth->errstr; 1371 1378 … … 1374 1381 } else { # done with alloctype=[sdcmw]i 1375 1382 1376 my $sth = $ip_dbh->prepare("select cidr,custid,type,city, description,notes from ".1383 my $sth = $ip_dbh->prepare("select cidr,custid,type,city,circuitid,description,notes from ". 1377 1384 "allocations where cidr='$webvar{block}'"); 1378 1385 $sth->execute(); 1379 1386 # croak $sth->errstr() if($sth->errstr()); 1380 1387 1381 $sth->bind_columns(\$cidr, \$custid, \$alloctype, \$city, \$ desc, \$notes);1382 $sth->fetch() || c roak$sth->errstr;1388 $sth->bind_columns(\$cidr, \$custid, \$alloctype, \$city, \$circid, \$desc, \$notes); 1389 $sth->fetch() || carp $sth->errstr; 1383 1390 } # end cases for different alloctypes 1384 1391 … … 1390 1397 $html =~ s|\$\$CITY\$\$|$city|g; 1391 1398 $html =~ s|\$\$CUSTID\$\$|$custid|g; 1399 $html =~ s|\$\$CIRCID\$\$|$circid|g; 1392 1400 $html =~ s|\$\$DESC\$\$|$desc|g; 1393 1401 $html =~ s|\$\$NOTES\$\$|$notes|g;
Note:
See TracChangeset
for help on using the changeset viewer.