Changeset 242


Ignore:
Timestamp:
04/19/05 15:42:43 (20 years ago)
Author:
Kris Deugau
Message:

/branches/stable

Merge ACL support from /branches/acl up to r241

Location:
branches/stable
Files:
1 deleted
8 edited
1 copied

Legend:

Unmodified
Added
Removed
  • branches/stable/cgi-bin/CommonWeb.pm

    r112 r242  
    5353}
    5454
    55 sub printHeader($) #(cgiurl)
    56 {
    57         my $cgiURL = $_[0];
    58         print "Content-type: text/html\n\n";
    59         open(FILE, "../header.inc") || die $!;
    60         while (<FILE>)
    61         {
    62                 $_ =~ s/\$\$CGIURL\$\$/$cgiURL/g;
    63                 print $_;
    64         }
    65         close(FILE);
     55
     56sub printHeader {
     57  my $title = shift;
     58  print "Content-type: text/html\n\n";
     59# This doesn't work well.  Must investigate.
     60#  my $realm = shift;
     61#  print qq(WWW-Authenticate: Basic realm="$realm"\n) if $realm;
     62  open FILE, "../header.inc"
     63        or carp $!;
     64  my $html = join('',<FILE>);
     65  close FILE;
     66
     67  $html =~ s/\$\$TITLE\$\$/$title/;
     68# Necessary for mangling arbitrary bits of the header
     69  my $i=0;
     70  while (defined(my $param = shift)) {
     71    $html =~ s/\$\$EXTRA$i\$\$/$param/g;
     72    $i++;
     73  }
     74  print $html;
    6675}
    6776
  • branches/stable/cgi-bin/IPDB.pm

    r192 r242  
    2323@EXPORT_OK    = qw(
    2424        %disp_alloctypes %list_alloctypes %def_custids @citylist @poplist @masterblocks
    25         %allocated %free %routed %bigfree
     25        %allocated %free %routed %bigfree %IPDBacl
    2626        &initIPDBGlobals &connectDB &finish &checkDBSanity &allocateBlock &deleteBlock
    2727        &mailNotify
     
    3131%EXPORT_TAGS    = ( ALL => [qw(
    3232                %disp_alloctypes %list_alloctypes %def_custids @citylist @poplist
    33                 @masterblocks %allocated %free %routed %bigfree
     33                @masterblocks %allocated %free %routed %bigfree %IPDBacl
    3434                &initIPDBGlobals &connectDB &finish &checkDBSanity &allocateBlock
    3535                &deleteBlock &mailNotify
     
    5050our %routed;
    5151our %bigfree;
     52our %IPDBacl;
    5253
    5354# Let's initialize the globals.
     
    8384  $sth = $dbh->prepare("select cidr from masterblocks order by cidr");
    8485  $sth->execute;
     86  return (undef,$sth->errstr) if $sth->err;
    8587  for (my $i=0; my @data = $sth->fetchrow_array(); $i++) {
    8688    $masterblocks[$i] = new NetAddr::IP $data[0];
     
    9193    $routed{"$masterblocks[$i]"} = 0;
    9294  }
     95
     96  # Load ACL data.  Specific username checks are done at a different level.
     97  $sth = $dbh->prepare("select username,acl from users");
     98  $sth->execute;
    9399  return (undef,$sth->errstr) if $sth->err;
     100  while (my @data = $sth->fetchrow_array) {
     101    $IPDBacl{$data[0]} = $data[1];
     102  }
    94103
    95104  return (1,"OK");
  • branches/stable/cgi-bin/admin.cgi

    r204 r242  
    3434}
    3535
    36 if ($authuser !~ /^(kdeugau|jodyh|jipp)$/) {
    37   print "Content-Type: text/html\n\n".
    38         "<html><head><title>Access denied</title></head><body>\n".
    39         'Access to this tool is restricted.  Contact <a href="mailto:kdeugau@vianet.ca">Kris</a> '.
    40         "for more information.</body></html>\n";
    41   exit;
    42 }
    43 
    4436syslog "debug", "$authuser active";
    4537
     
    5547initIPDBGlobals($ip_dbh);
    5648
     49if ($IPDBacl{$authuser} !~ /A/) {
     50  print "Content-Type: text/html\n\n".
     51        "<html><head><title>Access denied</title></head><body>\n".
     52        'Access to this tool is restricted.  Contact <a href="mailto:kdeugau@vianet.ca">Kris</a> '.
     53        "for more information.</body></html>\n";
     54  exit;
     55}
     56
    5757my %webvar = parse_post();
    5858cleanInput(\%webvar);
    5959
    6060print "Content-type: text/html\n\n".
    61         "<html>\n<head>\n\t<title>TEST [IPDB admin tools] TEST</title>\n".
     61        "<html>\n<head>\n\t<title>[IPDB admin tools]</title>\n".
    6262        qq(\t<link rel="stylesheet" type="text/css" href="/ip/ipdb.css">\n).
    6363        "</head>\n<body>\n".
     
    9191</form>
    9292<hr><a href="admin.cgi?action=showpools">List IP Pools</a> for manual tweaking and updates
     93<hr><a href="admin.cgi?action=showACL">Change ACLs</a> (change internal access controls -
     94note that this does NOT include IP-based limits)
    9395);
    9496} else {
     
    283285    syslog "notice", "$authuser updated pool IP $webvar{ip}";
    284286  }
    285 #  showPool("$data[0]");
    286 #} else {
    287 #  print "webvar{action} check failed: $webvar{action}";
     287} elsif ($webvar{action} eq 'showACL') {
     288  print "Notes:<br>\n".
     289        "<li>Users must be added to .htpasswd from the shell, for the time being.\n".
     290        "<li>New accounts will be added to the ACL here every time this page is loaded.\n".
     291        "<li>Old accounts will NOT be automatically deleted;  they must be removed via shell.\n".
     292        "<li>Admin users automatically get all other priviledges.\n";
     293# open .htpasswd, and snag the userlist.
     294  $sth = $ip_dbh->prepare("select count (*) from users where username=?");
     295  open HTPASS, "<../../.htpasswd" or carp "BOO! No .htpasswd file!";
     296  while (<HTPASS>) {
     297    chomp;
     298    my ($username,$encpwd) = split /:/;
     299    $sth->execute($username);
     300    my @data = $sth->fetchrow_array;
     301    if ($data[0] eq '0') {
     302      my $sth2 = $ip_dbh->prepare("insert into users (username,password) values ('$username','$encpwd')");
     303      $sth2->execute;
     304      print "$username added with read-only privs to ACL<br>\n";
     305    }
     306  }
     307
     308  print "<hr>Users with access:\n<table border=1>\n";
     309  print "<tr><td>Username</td><td>Add new</td><td>Change</td>".
     310        "<td>Delete</td><td>Admin user</td></tr>\n".
     311        "<form action=admin.cgi method=POST>\n";
     312  $sth = $ip_dbh->prepare("select username,acl from users order by username");
     313  $sth->execute;
     314  while (my @data = $sth->fetchrow_array) {
     315    print "<form action=admin.cgi method=POST><input type=hidden name=action value=updacl>".
     316        qq(<tr><td>$data[0]<input type=hidden name=username value="$data[0]"></td><td>).
     317    # Now for the fun bit.  We have to pull apart the ACL field and
     318    # output a bunch of checkboxes.
     319        "<input type=checkbox name=add".($data[1] =~ /a/ ? ' checked=y' : '').
     320        "></td><td><input type=checkbox name=change".($data[1] =~ /c/ ? ' checked=y' : '').
     321        "></td><td><input type=checkbox name=del".($data[1] =~ /d/ ? ' checked=y' : '').
     322        "></td><td><input type=checkbox name=admin".($data[1] =~ /A/ ? ' checked=y' : '').
     323        qq(></td><td><input type=submit value="Update"></td></tr></form>\n);
     324
     325  }
     326  print "</table>\n";
     327} elsif ($webvar{action} eq 'updacl') {
     328  print "Updating ACL for $webvar{username}:<br>\n";
     329  my $acl = 'b';
     330  if ($webvar{admin} eq 'on') {
     331    $acl .= "acdA";
     332  } else {
     333    $acl .= ($webvar{add} eq 'on' ? 'a' : '').
     334        ($webvar{change} eq 'on' ? 'c' : '').
     335        ($webvar{del} eq 'on' ? 'd' : '');
     336  }
     337  print "New ACL: $acl<br>\n";
     338
     339  $sth = $ip_dbh->prepare("update users set acl='$acl' where username='$webvar{username}'");
     340  $sth->execute;
     341  print "OK\n" if !$sth->err;
     342
     343  print qq(<hr><a href="admin.cgi?action=showACL">Back</a> to ACL listing\n);
     344
     345} elsif ($webvar{action} ne '<NULL>') {
     346  print "webvar{action} check failed: Don't know how to $webvar{action}";
    288347}
    289348
  • branches/stable/cgi-bin/ipdb.psql

    r192 r242  
    182182pr      Dynamic-route DSL netblock      Dynamic-route DSL       203     
    183183\.
     184
     185
     186--
     187-- User data table - required for proper ACLs
     188--
     189
     190CREATE TABLE "users" (
     191        "username" varchar(16) NOT NULL PRIMARY KEY,
     192        "password" varchar(16) DEFAULT '',
     193        "acl" varchar(16) DEFAULT 'b'
     194);
  • branches/stable/cgi-bin/main.cgi

    r224 r242  
    2323openlog "IPDB","pid","local2";
    2424
    25 # Collect the username from HTTP auth.  If undefined, we're in a test environment.
     25# Collect the username from HTTP auth.  If undefined, we're in
     26# a test environment, or called without a username.
    2627my $authuser;
    2728if (!defined($ENV{'REMOTE_USER'})) {
     
    4041($ip_dbh,$errstr) = connectDB_My;
    4142if (!$ip_dbh) {
    42   printAndExit("Database error: $errstr\n");
     43  exitError("Database error: $errstr\n");
    4344}
    4445initIPDBGlobals($ip_dbh);
     46
     47# Headerize!  Make sure we replace the $$EXTRA0$$ bit as needed.
     48printHeader('', ($IPDBacl{$authuser} =~ /a/ ?
     49        '<a href="/ip/cgi-bin/main.cgi?action=assign">Add new assignment</a>' : ''
     50        ));
     51
    4552
    4653#prototypes
     
    6572if($webvar{action} eq 'index') {
    6673  showSummary();
     74} elsif ($webvar{action} eq 'addmaster') {
     75  if ($IPDBacl{$authuser} !~ /a/) {
     76    printError("You shouldn't have been able to get here.  Access denied.");
     77  } else {
     78    open HTML, "<../addmaster.html";
     79    print while <HTML>;
     80  }
    6781} elsif ($webvar{action} eq 'newmaster') {
    68   printHeader('');
    69 
    70   my $cidr = new NetAddr::IP $webvar{cidr};
    71 
    72   print "<div type=heading align=center>Adding $cidr as master block....</div>\n";
    73 
    74   # Allow transactions, and raise an exception on errors so we can catch it later.
    75   # Use local to make sure these get "reset" properly on exiting this block
    76   local $ip_dbh->{AutoCommit} = 0;
    77   local $ip_dbh->{RaiseError} = 1;
    78 
    79   # Wrap the SQL in a transaction
    80   eval {
    81     $sth = $ip_dbh->prepare("insert into masterblocks values ('$webvar{cidr}')");
    82     $sth->execute;
     82
     83  if ($IPDBacl{$authuser} !~ /a/) {
     84    printError("You shouldn't have been able to get here.  Access denied.");
     85  } else {
     86
     87    my $cidr = new NetAddr::IP $webvar{cidr};
     88
     89    print "<div type=heading align=center>Adding $cidr as master block....</div>\n";
     90
     91    # Allow transactions, and raise an exception on errors so we can catch it later.
     92    # Use local to make sure these get "reset" properly on exiting this block
     93    local $ip_dbh->{AutoCommit} = 0;
     94    local $ip_dbh->{RaiseError} = 1;
     95
     96    # Wrap the SQL in a transaction
     97    eval {
     98      $sth = $ip_dbh->prepare("insert into masterblocks values ('$webvar{cidr}')");
     99      $sth->execute;
    83100
    84101# Unrouted blocks aren't associated with a city (yet).  We don't rely on this
     
    86103# Thus the "routed" flag.
    87104
    88     $sth = $ip_dbh->prepare("insert into freeblocks (cidr,maskbits,city,routed)".
     105      $sth = $ip_dbh->prepare("insert into freeblocks (cidr,maskbits,city,routed)".
    89106        " values ('$webvar{cidr}',".$cidr->masklen.",'<NULL>','n')");
    90     $sth->execute;
    91 
    92     # If we get here, everything is happy.  Commit changes.
    93     $ip_dbh->commit;
    94   }; # end eval
    95 
    96   if ($@) {
    97     carp "Transaction aborted because $@";
    98     eval { $ip_dbh->rollback; };
    99     syslog "err", "Could not add master block '$webvar{cidr}' to database: '$@'";
    100     printError("Could not add master block $webvar{cidr} to database: $@");
    101   } else {
    102     print "<div type=heading align=center>Success!</div>\n";
    103     syslog "info", "$authuser added master block $webvar{cidr}";
    104   }
     107      $sth->execute;
     108
     109      # If we get here, everything is happy.  Commit changes.
     110      $ip_dbh->commit;
     111    }; # end eval
     112
     113    if ($@) {
     114      carp "Transaction aborted because $@";
     115      eval { $ip_dbh->rollback; };
     116      syslog "err", "Could not add master block '$webvar{cidr}' to database: '$@'";
     117      printError("Could not add master block $webvar{cidr} to database: $@");
     118    } else {
     119      print "<div type=heading align=center>Success!</div>\n";
     120      syslog "info", "$authuser added master block $webvar{cidr}";
     121    }
     122
     123  } # ACL check
    105124
    106125} # end add new master
     
    116135}
    117136elsif($webvar{action} eq 'search') {
    118   printHeader('');
    119137  if (!$webvar{input}) {
    120138    # No search term.  Display everything.
     
    154172# which is not in any way guaranteed to provide anything useful.
    155173else {
    156   printHeader('');
    157174  my $rnd = rand 500;
    158175  my $boing = sprintf("%.2f", rand 500);
     
    172189print qq(<div align=right style="position: absolute; right: 30px;">).
    173190        qq(<a href="/ip/cgi-bin/admin.cgi">Admin tools</a></div><br>\n)
    174         if $authuser =~ /kdeugau|jodyh|jipp/;
     191        if $IPDBacl{$authuser} =~ /A/;
    175192
    176193# We print the footer here, so we don't have to do it elsewhere.
     
    393410# Initial display:  Show master blocks with total allocated subnets, total free subnets
    394411sub showSummary {
    395   # this is horrible-ugly-bad and will Go Away real soon now(TM)
    396   print "Content-type: text/html\n\n";
    397412
    398413  startTable('Master netblock', 'Routed netblocks', 'Allocated netblocks',
     
    451466  }
    452467  print "</table>\n";
    453   print qq(<a href="/ip/addmaster.shtml">Add new master block</a><br><br>\n);
     468  if ($IPDBacl{$authuser} =~ /a/) {
     469    print qq(<a href="/ip/cgi-bin/main.cgi?action=addmaster">Add new master block</a><br><br>\n);
     470  }
    454471  print "Note:  Free blocks noted here include both routed and unrouted blocks.\n";
    455472
     
    463480# else should follow.  YMMV.)
    464481sub showMaster {
    465   printHeader('');
    466482
    467483  print qq(<center><div class="heading">Summarizing routed blocks for ).
     
    539555    print qq(<hr width="60%"><center><div class="heading">No allocations in ).
    540556        qq($master.</div>\n).
    541         qq(<form action="/ip/cgi-bin/main.cgi" method=POST>\n).
    542         qq(<input type=hidden name=action value="delete">\n).
    543         qq(<input type=hidden name=block value="$master">\n).
    544         qq(<input type=hidden name=alloctype value="mm">\n).
    545         qq(<input type=submit value=" Remove this master ">\n).
    546         qq(</form></center>\n);
     557        ($IPDBacl{$authuser} =~ /d/ ?
     558                qq(<form action="/ip/cgi-bin/main.cgi" method=POST>\n).
     559                qq(<input type=hidden name=action value="delete">\n).
     560                qq(<input type=hidden name=block value="$master">\n).
     561                qq(<input type=hidden name=alloctype value="mm">\n).
     562                qq(<input type=submit value=" Remove this master ">\n).
     563                qq(</form></center>\n) :
     564                '');
    547565
    548566  } # end check for existence of routed blocks in master
     
    578596# not have anything useful to spew.
    579597sub showRBlock {
    580   printHeader('');
    581598
    582599  my $master = new NetAddr::IP $webvar{block};
     
    626643    print qq(<hr width="60%"><center><div class="heading">No allocations in ).
    627644        qq($master.</div></center>\n).
    628         qq(<form action="/ip/cgi-bin/main.cgi" method=POST>\n).
    629         qq(<input type=hidden name=action value="delete">\n).
    630         qq(<input type=hidden name=block value="$master">\n).
    631         qq(<input type=hidden name=alloctype value="rm">\n).
    632         qq(<input type=submit value=" Remove this block ">\n).
    633         qq(</form>\n);
     645        ($IPDBacl{$authuser} =~ /d/ ?
     646                qq(<form action="/ip/cgi-bin/main.cgi" method=POST>\n).
     647                qq(<input type=hidden name=action value="delete">\n).
     648                qq(<input type=hidden name=block value="$master">\n).
     649                qq(<input type=hidden name=alloctype value="rm">\n).
     650                qq(<input type=submit value=" Remove this block ">\n).
     651                qq(</form>\n) :
     652                '');
    634653  }
    635654
     
    650669    # Include some HairyPerl(TM) to prefix subblocks with "Sub "
    651670    my @row = ((($data[1] ne 'y' && $data[1] ne 'n') ? 'Sub ' : '').
    652         qq(<a href="/ip/cgi-bin/main.cgi?action=assign&block=$cidr&fbtype=$data[1]">$cidr</a>),
     671        ($IPDBacl{$authuser} =~ /a/ ? qq(<a href="/ip/cgi-bin/main.cgi?action=assign&block=$cidr&fbtype=$data[1]">$cidr</a>) : $cidr),
    653672        $cidr->range);
    654673    printRow(\@row, 'color1') if ($count%2 == 0);
     
    663682# List the IPs used in a pool
    664683sub listPool {
    665   printHeader('');
    666684
    667685  my $cidr = new NetAddr::IP $webvar{pool};
     
    709727    my @row = ( qq(<a href="/ip/cgi-bin/main.cgi?action=edit&block=$data[0]">$data[0]</a>),
    710728        $data[1],$data[2],$data[3],
    711         ( ($data[2] eq 'n') ?
     729        ( (($data[2] eq 'n') && ($IPDBacl{$authuser} =~ /d/)) ?
    712730          ("<a href=\"/ip/cgi-bin/main.cgi?action=delete&block=$data[0]&".
    713731           "alloctype=$data[4]\">Unassign this IP</a>") :
     
    726744# be one of two templates, and the lists come from the database.
    727745sub assignBlock {
    728   printHeader('');
     746
     747  if ($IPDBacl{$authuser} !~ /a/) {
     748    printError("You shouldn't have been able to get here.  Access denied.");
     749    return;
     750  }
    729751
    730752  my $html;
     
    804826# Take info on requested IP assignment and see what we can provide.
    805827sub confirmAssign {
    806   printHeader('');
     828  if ($IPDBacl{$authuser} !~ /a/) {
     829    printError("You shouldn't have been able to get here.  Access denied.");
     830    return;
     831  }
    807832
    808833  my $cidr;
     
    963988# Do the work of actually inserting a block in the database.
    964989sub insertAssign {
     990  if ($IPDBacl{$authuser} !~ /a/) {
     991    printError("You shouldn't have been able to get here.  Access denied.");
     992    return;
     993  }
    965994  # Some things are done more than once.
    966   printHeader('');
    967995  return if !validateInput();
    968996
     
    10781106# action=edit
    10791107sub edit {
    1080   printHeader('');
    10811108
    10821109  my $sql;
     
    10981125  $data[2] =~ s/\s//;
    10991126
    1100 ##fixme LEGACY CODE
    1101   # Postfix "i" on pool IP types
    1102   if ($data[2] =~ /^[cdsmw]$/) {
    1103     $data[2] .= "i";
    1104   }
    1105 
    11061127  open (HTML, "../editDisplay.html")
    11071128        or croak "Could not open editDisplay.html :$!";
     
    11141135# Needs thinking.  Have to allow changes to city to correct errors, no?
    11151136  $html =~ s/\$\$BLOCK\$\$/$webvar{block}/g;
    1116   $html =~ s/\$\$CITY\$\$/$data[3]/g;
     1137
     1138  if ($IPDBacl{$authuser} =~ /c/) {
     1139    $html =~ s/\$\$CUSTID\$\$/<input type=text name=custid value="$data[1]" maxlength=15 class="regular">/;
    11171140
    11181141# Screw it.  Changing allocation types gets very ugly VERY quickly- especially
     
    11231146
    11241147##fixme The check here should be built from the database
    1125   if ($data[2] =~ /^.[ne]$/) {
    1126     # Block that can be changed
    1127     my $blockoptions = "<select name=alloctype><option".
     1148    if ($data[2] =~ /^.[ne]$/) {
     1149      # Block that can be changed
     1150      my $blockoptions = "<select name=alloctype><option".
    11281151        (($data[2] eq 'me') ? ' selected' : '') ." value='me'>Dialup netblock</option>\n<option".
    11291152        (($data[2] eq 'de') ? ' selected' : '') ." value='de'>Dynamic DSL netblock</option>\n<option".
     
    11341157        (($data[2] eq 'in') ? ' selected' : '') ." value='in'>Internal netblock</option>\n".
    11351158        "</select>\n";
    1136     $html =~ s/\$\$TYPESELECT\$\$/$blockoptions/g;
     1159      $html =~ s/\$\$TYPESELECT\$\$/$blockoptions/g;
     1160    } else {
     1161      $html =~ s/\$\$TYPESELECT\$\$/$disp_alloctypes{$data[2]}<input type=hidden name=alloctype value="$data[2]">/g;
     1162    }
     1163    $html =~ s/\$\$CITY\$\$/<input type=text name=city value="$data[3]">/g;
     1164    $html =~ s/\$\$CIRCID\$\$/<input type="text" name="circid" value="$data[4]" maxlength=64 size=64 class="regular">/g;
     1165    $html =~ s/\$\$DESC\$\$/<input type="text" name="desc" value="$data[5]" maxlength=64 size=64 class="regular">/g;
     1166    $html =~ s|\$\$NOTES\$\$|<textarea rows="8" cols="64" name="notes" class="regular">$data[6]</textarea>|g;
    11371167  } else {
    1138     $html =~ s/\$\$TYPESELECT\$\$/$disp_alloctypes{$data[2]}<input type=hidden name=alloctype value="$data[2]">/g;
    1139   }
    1140 
    1141   # These can be modified, although CustID changes may get ignored.
    1142   $html =~ s/\$\$CUSTID\$\$/$data[1]/g;
    1143   $html =~ s/\$\$TYPE\$\$/$data[2]/g;
    1144   $html =~ s/\$\$CIRCID\$\$/$data[4]/g;
    1145   $html =~ s/\$\$DESC\$\$/$data[5]/g;
    1146   $html =~ s/\$\$NOTES\$\$/$data[6]/g;
     1168    $html =~ s/\$\$CUSTID\$\$/$data[1]/g;
     1169    $html =~ s/\$\$TYPESELECT\$\$/$disp_alloctypes{$data[2]}/g;
     1170    $html =~ s/\$\$CITY\$\$/$data[3]/g;
     1171    $html =~ s/\$\$CIRCID\$\$/$data[4]/g;
     1172    $html =~ s/\$\$DESC\$\$/$data[5]/g;
     1173    $html =~ s/\$\$NOTES\$\$/$data[6]/g;
     1174  }
     1175
     1176  # More ACL trickery - we can live with forms that don't submit,
     1177  # but we can't leave the extra table rows there, and we *really*
     1178  # can't leave the submit buttons there.
     1179  my $updok = '';
     1180  my $i=2;
     1181  if ($IPDBacl{$authuser} =~ /c/) {
     1182    $updok = qq(<tr class="color$i"><td colspan=2 class=regular><div class="center">).
     1183        qq(<input type="submit" value=" Update this block " class="regular">).
     1184        "</div></td></tr></form>\n";
     1185    $i--;
     1186  }
     1187  $html =~ s/\$\$UPDOK\$\$/$updok/g;
     1188
     1189  my $delok = '';
     1190  if ($IPDBacl{$authuser} =~ /d/) {
     1191    $delok = qq(<form method="POST" action="main.cgi">
     1192        <tr class="color$i"><td colspan=2 class="regular"><div class=center>
     1193        <input type="hidden" name="action" value="delete">
     1194        <input type="hidden" name="block" value="$webvar{block}">
     1195        <input type="hidden" name="alloctype" value="$data[2]">
     1196        <input type=submit value=" Delete this block ">
     1197        </div></td></tr>);
     1198  }
     1199  $html =~ s/\$\$DELOK\$\$/$delok/;
    11471200
    11481201  print $html;
     
    11541207# action=update
    11551208sub update {
    1156   printHeader('');
    11571209
    11581210  # Make sure incoming data is in correct format - custID among other things.
     
    12131265# Delete an allocation.
    12141266sub remove {
    1215   printHeader('');
     1267  if ($IPDBacl{$authuser} !~ /d/) {
     1268    printError("You shouldn't have been able to get here.  Access denied.");
     1269    return;
     1270  }
     1271
    12161272  #show confirm screen.
    12171273  open HTML, "../confirmRemove.html"
     
    13031359# Remove IPs from pool listing if necessary
    13041360sub finalDelete {
    1305   printHeader('');
     1361  if ($IPDBacl{$authuser} !~ /d/) {
     1362    printError("You shouldn't have been able to get here.  Access denied.");
     1363    return;
     1364  }
    13061365
    13071366  my ($code,$msg) = deleteBlock($ip_dbh, $webvar{block}, $webvar{alloctype});
     
    13261385
    13271386
     1387sub exitError {
     1388  my $errStr = $_[0];
     1389  printHeader('','');
     1390  print qq(<center><p class="regular"> $errStr </p>
     1391<input type="button" value="Back" onclick="history.go(-1)">
     1392</center>
     1393);
     1394  printFooter();
     1395  exit;
     1396} # errorExit
     1397
     1398
    13281399# Just in case we manage to get here.
    13291400exit 0;
  • branches/stable/editDisplay.html

    r75 r242  
    88<tr class="color1"><td class=heading>IP block:</td><td class="regular">$$BLOCK$$</td></tr>
    99
    10 <tr class="color2"><td class=heading>City:</td><td class="regular">
    11 <input type=text name=city value="$$CITY$$"></td></tr>
     10<tr class="color2"><td class=heading>City:</td><td class="regular">$$CITY$$</td></tr>
    1211
    1312<tr class="color1"><td class=heading>Type:</td><td class=regular>$$TYPESELECT$$</td></tr>
    1413
    15 <tr class="color2"><td class=heading>CustID:</td><td class="regular">
    16 <input type=text name=custid value="$$CUSTID$$" maxlength=15 class="regular"></td></tr>
     14<tr class="color2"><td class=heading>CustID:</td><td class="regular">$$CUSTID$$</td></tr>
    1715
    18 <tr class="color1"><td class="heading">Circuit ID:</td><td class="regular">
    19 <input type="text" name="circid" value="$$CIRCID$$" maxlength=64 size=64 class="regular"></td></tr>
     16<tr class="color1"><td class="heading">Circuit ID:</td><td class="regular">$$CIRCID$$</td></tr>
    2017
    21 <tr class="color2"><td class="heading">Description/Name:</td><td class="regular">
    22 <input type="text" name="desc" value="$$DESC$$" maxlength=64 size=64 class="regular"></td></tr>
     18<tr class="color2"><td class="heading">Description/Name:</td><td class="regular">$$DESC$$</td></tr>
    2319
    24 <tr class="color1"><td class="heading" valign="top">Notes:</td><td class="regular">
    25 <textarea rows="8" cols="64" name="notes" class="regular">$$NOTES$$</textarea></td></tr>
     20<tr class="color1"><td class="heading" valign="top">Notes:</td><td class="regular">$$NOTES$$</td></tr>
    2621
    27 <tr class="color2"><td colspan=2 class=regular><div class="center">
    28 <input type="submit" value=" Update this block " class="regular">
    29 </div></td></tr></form>
    30 <form method="POST" action="main.cgi">
    31 <tr class="color1"><td colspan=2 class="regular"><div class=center>
    32 <input type="hidden" name="action" value="delete">
    33 <input type="hidden" name="block" value="$$BLOCK$$">
    34 <input type="hidden" name="alloctype" value="$$TYPE$$">
    35 <input type=submit value=" Delete this block ">
    36 </div></td></tr>
     22$$UPDOK$$
     23$$DELOK$$
    3724</form>
    3825
  • branches/stable/header.inc

    r85 r242  
    11<html>
    22<head>
    3         <title>[IP Database v2]</title>
     3        <title>MERGE [IP Database v2] MERGE</title>
    44        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    55        <link rel="stylesheet" type="text/css" href="/ip/ipdb.css">
     
    2121
    2222</head>
    23 <body bgcolor="#ffffff" text="#000000" link="#000000" vlink="#000000" alink="#ff0000" leftmargin="0" topmargin="0" marginwidth="0" style="font-family: helvetica">
     23<body bgcolor="#9999ff" text="#000000" link="#000000" vlink="#000000" alink="#ff0000" leftmargin="0" topmargin="0" marginwidth="0" style="font-family: helvetica">
    2424
    2525<table width="98%" border="0" cellspacing="0" cellpadding="0" height="0">
     
    2929      <div align="right"><b><font face="Verdana, Arial, Helvetica, sans-serif" size="2">
    3030          <a href="/ip/index.shtml">
    31           [IP Database v2 Home]</a></font></b></div>
     31          MERGE [IP Database v2 Home] MERGE</a></font></b></div>
    3232    </td>
    3333  </tr>
     
    5151<input type="button" value=" Help? " onclick="openHelp()" class="regular">
    5252&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    53 <a href="/ip/cgi-bin/main.cgi?action=assign">Add new assignment</a>
     53$$EXTRA0$$
    5454</td>
    5555</form>
  • branches/stable/index.shtml

    r125 r242  
    1 <!--#include file="header.inc"-->
    21<!--#include virtual="/ip/cgi-bin/main.cgi?action=index" -->
Note: See TracChangeset for help on using the changeset viewer.