Changeset 282 for branches/privdata/cgi-bin
- Timestamp:
- 09/21/05 14:09:35 (19 years ago)
- Location:
- branches/privdata/cgi-bin
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/privdata/cgi-bin/IPDB.pm
r256 r282 184 184 # Does all of the magic of actually allocating a netblock 185 185 # Requires database handle, block to allocate, custid, type, city, 186 # description, notes, circuit ID, block to allocate from, 186 # description, notes, circuit ID, block to allocate from, private data 187 187 # Returns a success code and optional error message. 188 188 sub allocateBlock { 189 my ($dbh,undef,undef,$custid,$type,$city,$desc,$notes,$circid ) = @_;190 189 my ($dbh,undef,undef,$custid,$type,$city,$desc,$notes,$circid,$privdata) = @_; 190 191 191 my $cidr = new NetAddr::IP $_[1]; 192 192 my $alloc_from = new NetAddr::IP $_[2]; … … 220 220 $sth = $dbh->prepare("update poolips set custid='$custid',". 221 221 "city='$city',available='n',description='$desc',notes='$notes',". 222 "circuitid='$circid' ".222 "circuitid='$circid',privdata='$privdata'". 223 223 " where ip='$cidr'"); 224 224 $sth->execute; … … 263 263 } 264 264 $sth = $dbh->prepare("insert into allocations". 265 " (cidr,custid,type,city,description,notes,maskbits,circuitid )".265 " (cidr,custid,type,city,description,notes,maskbits,circuitid,privdata)". 266 266 " values ('$cidr','$custid','$type','$city','$desc','$notes',". 267 $cidr->masklen.",'$circid' )");267 $cidr->masklen.",'$circid','$privdata')"); 268 268 $sth->execute; 269 269 … … 361 361 # Insert the allocations entry 362 362 $sth = $dbh->prepare("insert into allocations (cidr,custid,type,city,". 363 "description,notes,maskbits,circuitid )".363 "description,notes,maskbits,circuitid,privdata)". 364 364 " values ('$cidr','$custid','$type','$city','$desc','$notes',". 365 $cidr->masklen.",'$circid' )");365 $cidr->masklen.",'$circid','$privdata')"); 366 366 $sth->execute; 367 367 -
branches/privdata/cgi-bin/main.cgi
r280 r282 626 626 } 627 627 $html =~ s|\$\$ALLCITIES\$\$|$cities|g; 628 629 my $i = 0; 630 $i++ if $webvar{fbtype} eq 'y'; 631 # Check to see if user is allowed to do anything with sensitive data 632 my $privdata = ''; 633 if ($IPDBacl{$authuser} =~ /s/) { 634 $privdata = qq(<tr class="color).($i%2).qq("><td>Restricted data:</td>). 635 qq(<td class=regular><textarea rows="3" cols="64" name="privdata" class="regular">). 636 qq(</textarea></td></tr>\n); 637 $i++; 638 } 639 $html =~ s/\$\$PRIVDATA\$\$/$privdata/g; 640 641 $i = $i % 2; 642 $html =~ s/\$\$BUTTONROWCOLOUR\$\$/color$i/; 628 643 629 644 print $html; … … 789 804 $html =~ s|\$\$ACTION\$\$|insert|g; 790 805 806 my $i=1; 807 # Check to see if user is allowed to do anything with sensitive data 808 my $privdata = ''; 809 if ($IPDBacl{$authuser} =~ /s/) { 810 $privdata = qq(<tr class="color).($i%2).qq("><td>Restricted data:</td>). 811 qq(<td class=regular>$webvar{privdata}). 812 qq(<input type=hidden name=privdata value="$webvar{privdata}"></td></tr>\n); 813 $i++; 814 } 815 $html =~ s/\$\$PRIVDATA\$\$/$privdata/g; 816 817 $i = $i % 2; 818 $html =~ s/\$\$BUTTONROWCOLOUR\$\$/color$i/; 819 791 820 print $html; 792 821 … … 803 832 return if !validateInput(); 804 833 834 if (!defined($webvar{privdata})) { 835 $webvar{privdata} = ''; 836 } 805 837 # $code is "success" vs "failure", $msg contains OK for a 806 838 # successful netblock allocation, the IP allocated for static … … 808 840 my ($code,$msg) = allocateBlock($ip_dbh, $webvar{fullcidr}, $webvar{alloc_from}, 809 841 $webvar{custid}, $webvar{alloctype}, $webvar{city}, $webvar{desc}, $webvar{notes}, 810 $webvar{circid} );842 $webvar{circid}, $webvar{privdata}); 811 843 812 844 if ($code eq 'OK') { … … 1105 1137 } 1106 1138 1107 my ($cidr, $custid, $type, $city, $circid, $desc, $notes, $alloctype );1139 my ($cidr, $custid, $type, $city, $circid, $desc, $notes, $alloctype, $privdata); 1108 1140 1109 1141 if ($webvar{alloctype} eq 'rm') {
Note:
See TracChangeset
for help on using the changeset viewer.