source: branches/stable/cgi-bin/admin.cgi@ 325

Last change on this file since 325 was 319, checked in by Kris Deugau, 19 years ago

/branches/stable

Cosmetic fixups.
admin.cgi:

  • Added links to freespace.pl and consistency-check.pl from admin tools
  • Added note on user management noting global general read access

freespace.pl:

  • Added headings to output sections for clarity

All changed files:

  • Updated copyright lines
  • Property svn:executable set to *
  • Property svn:keywords set to Date Rev Author
File size: 19.9 KB
Line 
1#!/usr/bin/perl
2# ipdb/cgi-bin/admin.cgi
3# Hack interface to make specific changes to IPDB that (for one reason
4# or another) can't be made through the main interface.
5#
6###
7# SVN revision info
8# $Date: 2006-04-03 20:31:11 +0000 (Mon, 03 Apr 2006) $
9# SVN revision $Rev: 319 $
10# Last update by $Author: kdeugau $
11###
12# Copyright (C) 2004-2006 - Kris Deugau
13
14use strict;
15use warnings;
16use CGI::Carp qw(fatalsToBrowser);
17use DBI;
18use CommonWeb qw(:ALL);
19use MyIPDB;
20use CustIDCK;
21#use POSIX qw(ceil);
22use NetAddr::IP;
23
24use Sys::Syslog;
25
26openlog "IPDB-admin","pid","local2";
27
28# Collect the username from HTTP auth. If undefined, we're in a test environment.
29my $authuser;
30if (!defined($ENV{'REMOTE_USER'})) {
31 $authuser = '__temptest';
32} else {
33 $authuser = $ENV{'REMOTE_USER'};
34}
35
36syslog "debug", "$authuser active";
37
38# Why not a global DB handle? (And a global statement handle, as well...)
39# Use the connectDB function, otherwise we end up confusing ourselves
40my $ip_dbh;
41my $sth;
42my $errstr;
43($ip_dbh,$errstr) = connectDB_My;
44if (!$ip_dbh) {
45 printAndExit("Database error: $errstr\n");
46}
47initIPDBGlobals($ip_dbh);
48
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
57my %webvar = parse_post();
58cleanInput(\%webvar);
59
60print "Content-type: text/html\n\n".
61 "<html>\n<head>\n\t<title>[IPDB admin tools]</title>\n".
62 qq(\t<link rel="stylesheet" type="text/css" href="/ip/ipdb.css">\n).
63 "</head>\n<body>\n".
64 "<h2>IPDB - Administrative Tools</h2>\n<hr>\n";
65
66if(!defined($webvar{action})) {
67 $webvar{action} = "<NULL>"; #shuts up the warnings.
68
69 my $typelist = '';
70 $sth = $ip_dbh->prepare("select type,listname from alloctypes where listorder < 900 order by listorder");
71 $sth->execute;
72 my @data = $sth->fetchrow_array;
73 $typelist .= "<option value='$data[0]' selected>$data[1]</option>\n";
74 while (my @data = $sth->fetchrow_array) {
75 $typelist .= "<option value='$data[0]'>$data[1]</option>\n";
76 }
77
78 print qq(WARNING: There are FAR fewer controls on what you can do here. Use the
79main interface if at all possible.
80<hr>
81<a href="admin.cgi?action=newalloc">Add allocation</a>
82<hr>
83<form action="admin.cgi" method="POST">
84<input type=hidden name=action value=alloc>
85Allocate block/IP: <input name=cidr> as <select name=alloctype>$typelist</select> to <input name=custid>
86<input type=submit value=" GIMME!! "></form>
87<hr><form action="admin.cgi" method="POST">
88<input type=hidden name=action value=alloctweak>
89Manually update allocation data in this /24: <input name=allocfrom>
90<input type=submit value="Show allocations">
91</form>
92<hr><a href="admin.cgi?action=showpools">List IP Pools</a> for manual tweaking and updates
93<hr><a href="admin.cgi?action=showusers">Manage users</a> (add/remove users; change
94internal access controls - note that this does NOT include IP-based limits)
95<hr>Consistency check tools<br>
96<a href="consistency-check.pl">General</a>: Check general netblock consistency.<br>
97<a href="freespace.pl">Free space</a>: List total and aggregate free space. Does not
98include private networks (192.168.0.0/16, 172.16.0.0/12, 10.0.0.0/8)
99);
100} else {
101 print '<a href="/ip/cgi-bin/admin.cgi">Back</a> to main<hr>';
102}
103
104
105## Possible actions.
106if ($webvar{action} eq 'alloc') {
107 # OK, we know what we're allocating.
108
109 if ($webvar{cidr} !~ /^\s*(\d{1,3}\.){3}\d{1,3}(\/\d{2})?\s*$/) {
110 printAndExit("Can't allocate something that's not a netblock/ip");
111 }
112
113 $sth = $ip_dbh->prepare("select def_custid from alloctypes where type='$webvar{alloctype}'");
114 $sth->execute;
115 my @data = $sth->fetchrow_array;
116 my $custid = $data[0];
117 if ($custid eq '') {
118 if ($webvar{custid} !~ /^(?:\d{10}|\d{7}|STAFF)(?:-\d\d?)?$/) {
119 # Force uppercase for now...
120 $webvar{custid} =~ tr/a-z/A-Z/;
121 # Crosscheck with ... er... something.
122 my $status = CustIDCK->custid_exist($webvar{custid});
123 if ($CustIDCK::Error) {
124 printError("Error verifying customer ID: ".$CustIDCK::ErrMsg);
125 return;
126 }
127 if (!$status) {
128 printError("Customer ID not valid. Make sure the Customer ID ".
129 "is correct.<br>\nUse STAFF for staff static IPs, and 6750400 for any other ".
130 "non-customer assignments.");
131 return;
132 }
133 }
134 # Type that doesn't have a default custid
135 $custid = $webvar{custid};
136 }
137
138 my $cidr = new NetAddr::IP $webvar{cidr};
139 my @data;
140 if ($webvar{alloctype} eq 'rm') {
141 $sth = $ip_dbh->prepare("select cidr from freeblocks where cidr >>='$cidr' and routed='n'");
142 $sth->execute;
143 @data = $sth->fetchrow_array;
144# User deserves errors if user can't be bothered to find the free block first.
145 printAndExit("Can't allocate from outside a free block!!\n")
146 if !$data[0];
147 } elsif ($webvar{alloctype} =~ /^(.)i$/) {
148 $sth = $ip_dbh->prepare("select cidr from allocations where cidr >>='$cidr' and (type like '_d' or type like '_p')");
149 $sth->execute;
150 @data = $sth->fetchrow_array;
151# User deserves errors if user can't be bothered to find the pool and a free IP first.
152 printAndExit("Can't allocate static IP from outside a pool!!\n")
153 if !$data[0];
154 } else {
155 $sth = $ip_dbh->prepare("select cidr from freeblocks where cidr >>='$cidr' and not (routed='n')");
156 $sth->execute;
157 @data = $sth->fetchrow_array;
158# User deserves errors if user can't be bothered to find the free block first.
159 printAndExit("Can't allocate from outside a routed block!!\n")
160 if !$data[0];
161 }
162
163 my $alloc_from = new NetAddr::IP $data[0];
164 $sth->finish;
165
166 my $cities = '';
167 foreach my $city (@citylist) {
168 $cities .= "<option>$city</option>\n";
169 }
170
171 print qq(<table class=regular>
172<form method=POST action=admin.cgi>
173<tr class=color1>
174<td>Allocating:</td>
175<td>$cidr<input type=hidden name=cidr value="$cidr"></td>
176</tr><tr class=color2>
177<td>Type:</td><td>$disp_alloctypes{$webvar{alloctype}}
178<input type=hidden name=alloctype value="$webvar{alloctype}"></td>
179</tr><tr class=color1>
180<td>Allocated from:</td>
181<td>$alloc_from<input type=hidden name=alloc_from value="$alloc_from"></td>
182</tr><tr class="color2">
183<td>Customer ID:</td><td>$custid<input type=hidden name=custid value="$custid"></td>
184</tr><tr class=color1>
185<td>Customer location:</td><td>
186<select name="city"><option selected>-</option>
187$cities
188</select>
189&nbsp;<a href="javascript:popNotes('/ip/newcity.html')">Add new location</a>
190</td>
191</tr>
192<tr class="color2">
193<td>Circuit ID:</td><td><input name=circid size=40></td>
194</tr><tr class="color1">
195<td>Description/Name:</td><td><input name="desc" size=40></td>
196</tr><tr class="color2">
197<td>Notes:</td><td><textarea name="notes" rows="3" cols="40"></textarea></td>
198</tr><tr class="warning">
199<td colspan=2><center>WARNING: This will IMMEDIATELY assign this block!!</center></td>
200</tr><tr class="color2">
201<td class="center" colspan="2"><input type="submit" value=" Assign "></td>
202<input type="hidden" name="action" value="confirm">
203</form>
204</tr>
205</table>
206);
207
208
209} elsif ($webvar{action} eq 'confirm') {
210
211 print "Assigning $webvar{cidr} to $webvar{custid} (\"$webvar{desc}\") as ".
212 "$disp_alloctypes{$webvar{alloctype}}...<br>\n";
213 # Only need to check city here.
214 if ($webvar{city} eq '-') {
215 printError("Invalid customer location! Go back and select customer's location.");
216 } else {
217 if ($webvar{alloctype} =~ /^.i$/) {
218 $sth = $ip_dbh->prepare("update poolips set available='n', custid='$webvar{custid}', ".
219 "city='$webvar{city}', description='$webvar{desc}', notes='$webvar{notes}' ".
220 "where ip='$webvar{cidr}'");
221 $sth->execute;
222 if ($sth->err) {
223 print "Allocation failed! DBI said:\n".$sth->errstr."\n";
224 syslog "err", "($authuser) Allocation of '$webvar{cidr}' to '$webvar{custid}' as ".
225 "'$webvar{alloctype}' failed: '".$sth->errstr."'";
226 } else {
227 print "Allocation OK!\n";
228 syslog "notice", "$authuser allocated '$webvar{cidr}' to '$webvar{custid}' as ".
229 "'$webvar{alloctype}'";
230 # Notify tech@example.com
231 mailNotify('tech@example.com',"$disp_alloctypes{$webvar{alloctype}} allocation",
232 "$disp_alloctypes{$webvar{alloctype}} $webvar{cidr} allocated to customer".
233 " $webvar{custid}\n".
234 "Description: $webvar{desc}\n\nAllocated by: $authuser\n");
235 }
236 } else {
237 my ($retcode,$msg) = allocateBlock($ip_dbh, $webvar{cidr}, $webvar{alloc_from},
238 $webvar{custid}, $webvar{alloctype}, $webvar{city}, $webvar{desc}, $webvar{notes},
239 $webvar{circid});
240 if ($retcode eq 'OK') {
241 print "Allocation OK!\n";
242 syslog "notice", "$authuser allocated '$webvar{cidr}' to '$webvar{custid}' as ".
243 "'$webvar{alloctype}'";
244 } else {
245 print "Allocation failed! IPDB::allocateBlock said:\n$msg\n";
246 syslog "err", "($authuser) Allocation of '$webvar{cidr}' to '$webvar{custid}' as ".
247 "'$webvar{alloctype}' failed: '$msg'";
248 }
249 } # static IP vs netblock
250
251 } # done city check
252
253} elsif ($webvar{action} eq 'alloctweak') {
254 fix_allocfrom();
255 showAllocs($webvar{allocfrom});
256} elsif ($webvar{action} eq 'update') {
257 update();
258} elsif ($webvar{action} eq 'assign') {
259 # Display a list of possible blocks within the requested block.
260 open (HTML, "../admin_alloc.html")
261 or croak "Could not open admin_alloc.html :$!";
262 my $html = join('', <HTML>);
263 $html =~ s/\$\$MASK\$\$/$webvar{masklen}/g;
264 $html =~ s/\$\$ALLOCFROM\$\$/$webvar{allocfrom}/g;
265
266 my $from = new NetAddr::IP $webvar{allocfrom};
267 my @blocklist = $from->split($webvar{masklen});
268 my $availblocks;
269 foreach (@blocklist) {
270 $availblocks .= qq(<tr><td colspan=2 align=center><input type=radio name=block value="$_">$_</td></tr>\n);
271 }
272 $html =~ s/\$\$BLOCKLIST\$\$/$availblocks/g;
273
274 print $html;
275} elsif ($webvar{action} eq 'showpools') {
276 print "IP Pools currently allocated:\n".
277 "<table border=1>\n<tr><td>Pool</td><td># of free IPs</td></tr>\n";
278 $sth = $ip_dbh->prepare("select cidr from allocations where type like '%p' or type like '%d' order by cidr");
279 $sth->execute;
280 my %poolfree;
281 while (my @data = $sth->fetchrow_array) {
282 $poolfree{$data[0]} = 0;
283 }
284 $sth = $ip_dbh->prepare("select pool,ip from poolips where available='y' order by ip");
285 $sth->execute;
286 while (my @data = $sth->fetchrow_array) {
287 $poolfree{$data[0]}++;
288 }
289 foreach my $key (keys %poolfree) {
290 print qq(<tr><td><a href="admin.cgi?action=tweakpool&pool=$key">$key</a></td>).
291 "<td>$poolfree{$key}</td></tr>\n";
292 }
293 print "</table>\n";
294} elsif ($webvar{action} eq 'tweakpool') {
295 showPool($webvar{pool});
296} elsif ($webvar{action} eq 'updatepool') {
297
298 $sth = $ip_dbh->prepare("update poolips set custid='$webvar{custid}', ".
299 "city='$webvar{city}', type='$webvar{type}', available='".
300 (($webvar{available} eq 'y') ? 'y' : 'n').
301 "', notes='$webvar{notes}', description='$webvar{desc}' ".
302 "where ip='$webvar{ip}'");
303 $sth->execute;
304 if ($sth->err) {
305 print "Error updating pool IP $webvar{ip}: $@<hr>\n";
306 syslog "err", "$authuser could not update pool IP $webvar{ip}: $@";
307 } else {
308 $sth = $ip_dbh->prepare("select pool from poolips where ip='$webvar{ip}'");
309 $sth->execute;
310 my @data = $sth->fetchrow_array;
311 print "$webvar{ip} in $data[0] updated\n<hr>\n";
312 syslog "notice", "$authuser updated pool IP $webvar{ip}";
313 }
314} elsif ($webvar{action} eq 'showusers') {
315 print "Notes:<br>\n".
316 "<li>Admin users automatically get all other priviledges.\n".
317 "<li>Everyone has basic read access.\n".
318 "<hr>Add new user:<form action=admin.cgi method=POST>\n".
319 "Username: <input name=username><br>\n".
320 "Password: <input name=password> <input type=checkbox name=preenc>Password is pre-encrypted (MUST be crypt() encrypted)<br>\n".
321 "<input type=submit value='Add user'><input type=hidden name=action value=newuser></form>\n";
322
323 print "<hr>Users with access:\n<table border=1>\n";
324 print "<tr><td></td><td align=center colspan=3>General access</td></tr>\n";
325 print "<tr><td>Username</td><td>Add new</td><td>Change</td>".
326 "<td>Delete</td><td>Systems/Networking</td><td>Admin user</td></tr>\n".
327 "<form action=admin.cgi method=POST>\n";
328 $sth = $ip_dbh->prepare("select username,acl from users order by username");
329 $sth->execute;
330 while (my @data = $sth->fetchrow_array) {
331 print "<form action=admin.cgi method=POST><input type=hidden name=action value=updacl>".
332 qq(<tr><td>$data[0]<input type=hidden name=username value="$data[0]"></td><td>).
333 # Now for the fun bit. We have to pull apart the ACL field and
334 # output a bunch of checkboxes.
335 "<input type=checkbox name=add".($data[1] =~ /a/ ? ' checked=y' : '').
336 "></td><td><input type=checkbox name=change".($data[1] =~ /c/ ? ' checked=y' : '').
337 "></td><td><input type=checkbox name=del".($data[1] =~ /d/ ? ' checked=y' : '').
338 "></td><td><input type=checkbox name=sysnet".($data[1] =~ /s/ ? ' checked=y' : '').
339 "></td><td><input type=checkbox name=admin".($data[1] =~ /A/ ? ' checked=y' : '').
340 qq(></td><td><input type=submit value="Update"></td></form>\n).
341 "<form action=admin.cgi method=POST><td><input type=hidden name=action value=deluser>".
342 "<input type=hidden name=username value=$data[0]>".
343 qq(<input type=submit value="Delete user"></tr></form>\n);
344
345 }
346 print "</table>\n";
347} elsif ($webvar{action} eq 'updacl') {
348 print "Updating ACL for $webvar{username}:<br>\n";
349 my $acl = 'b';
350 if ($webvar{admin} eq 'on') {
351 $acl .= "acdsA";
352 } else {
353 $acl .= ($webvar{add} eq 'on' ? 'a' : '').
354 ($webvar{change} eq 'on' ? 'c' : '').
355 ($webvar{del} eq 'on' ? 'd' : '').
356 ($webvar{sysnet} eq 'on' ? 's' : '');
357 }
358 print "New ACL: $acl<br>\n";
359
360 $sth = $ip_dbh->prepare("update users set acl='$acl' where username='$webvar{username}'");
361 $sth->execute;
362 print "OK\n" if !$sth->err;
363
364 print qq(<hr><a href="admin.cgi?action=showusers">Back</a> to user listing\n);
365
366} elsif ($webvar{action} eq 'newuser') {
367 print "Adding user $webvar{username}...\n";
368 my $cr_pass = ($webvar{preenc} ? $webvar{password} :
369 crypt $webvar{password}, join('',('.','/',0..9,'A'..'Z','a'..'z')[rand 64, rand 64]));
370 $sth = $ip_dbh->prepare("insert into users (username,password,acl) values ".
371 "('$webvar{username}','$cr_pass','b')");
372 $sth->execute;
373 if ($sth->err) {
374 print "<br>Error adding user: ".$sth->errstr;
375 } else {
376 print "OK\n";
377 }
378
379 print qq(<hr><a href="admin.cgi?action=showusers">Back</a> to user listing\n);
380
381} elsif ($webvar{action} eq 'deluser') {
382 print "Deleting user $webvar{username}.<br>\n";
383 $sth = $ip_dbh->prepare("delete from users where username='$webvar{username}'");
384 $sth->execute;
385 print "OK\n" if !$sth->err;
386
387 print qq(<hr><a href="admin.cgi?action=showusers">Back</a> to user listing\n);
388
389} elsif ($webvar{action} ne '<NULL>') {
390 print "webvar{action} check failed: Don't know how to $webvar{action}";
391}
392
393# Hokay. This is a little different. We have a few specific functions here:
394# -> Assign arbitrary subnet from arbitrary free space
395# -> Tweak individual DB fields
396#
397
398
399printFooter;
400
401$ip_dbh->disconnect;
402
403exit;
404
405
406# Tweak allocfrom into shape.
407sub fix_allocfrom {
408 if ($webvar{allocfrom} =~ /^(\d+\.){2}\d+$/) {
409 # 3-octet class C specified
410 $webvar{allocfrom} .= ".0/24";
411 } elsif ($webvar{allocfrom} =~ /^(\d+\.){3}\d+$/) {
412 # 4-octet IP specified;
413 $webvar{allocfrom} .= "/24";
414 }
415}
416
417
418# List free blocks in a /24 for arbitrary manual allocation
419sub showfree($) {
420 my $cidr = new NetAddr::IP $_[0];
421 print "Showing free blocks in $cidr<br>\n".
422 "<table border=1>\n";
423 $sth = $ip_dbh->prepare("select * from freeblocks where cidr <<= '$cidr' order by cidr");
424 $sth->execute;
425 while (my @data = $sth->fetchrow_array) {
426 my $temp = new NetAddr::IP $data[0];
427 print "<tr><form action=admin.cgi method=POST><input type=hidden name=action value=assign>\n".
428 qq(<td>$temp<input type=hidden name=allocfrom value="$temp"></td>\n).
429 "<td>".
430 (($temp->masklen == 30) ? '<input type=hidden name=masklen value=30>30'
431 : "<select name=masklen><option>30</option>\n<option>29</option>\n") .
432 (($temp->masklen < 29) ? "<option>28</option>\n" : '') .
433 (($temp->masklen < 28) ? "<option>27</option>\n" : '') .
434 (($temp->masklen < 27) ? "<option>26</option>\n" : '') .
435 (($temp->masklen < 26) ? "<option>25</option>\n" : '') .
436 (($temp->masklen < 25) ? "<option>24</option>\n" : '') .
437 "</td>".
438 qq(<td>$data[2]</td><td><input type=submit value="Allocate from here"></td>).
439 "\n</form></tr>\n";
440 }
441 print "</table>\n";
442}
443
444
445# Show allocations to allow editing.
446sub showAllocs($) {
447 my $cidr = new NetAddr::IP $_[0];
448 print "Edit custID, allocation type, city for allocations in ".
449 "$cidr:\n<table border=1>";
450 $sth = $ip_dbh->prepare("select * from allocations where cidr <<= '$cidr' order by cidr");
451 $sth->execute;
452 while (my @data = $sth->fetchrow_array) {
453 print "<tr><form action=admin.cgi method=POST><input type=hidden name=action value=update>\n".
454 qq(<td>$data[0]<input type=hidden value="$data[0]" name=block></td>\n).
455 qq(<td><input name=custid value="$data[1]"></td>\n).
456 "<td><select name=alloctype>";
457
458 my $sth2 = $ip_dbh->prepare("select type,listname from alloctypes".
459 " where listorder < 500 and not (type like '_i') order by listorder");
460 $sth2->execute;
461 while (my @types = $sth2->fetchrow_array) {
462 print "<option". (($data[2] eq $types[0]) ? ' selected' : '') .
463 " value='$types[0]'>$types[1]</option>\n";
464 }
465 print "<option". (($data[2] eq 'in') ? ' selected' : '') .
466 " value='in'>Internal netblock</option>\n</select></td>\n";
467
468 print qq(<td><input name=city value="$data[3]"></td>\n).
469 "<td>$data[4]</td><td>$data[5]</td>".
470 qq(<td><input type=submit value="Update"></td></form></tr>\n);
471 }
472 print "</table>\n";
473
474 # notes
475 print "<hr><b>Notes:</b>\n".
476 "<ul>\n<li>Use the main interface to update description and notes fields\n".
477 "<li>Changing the allocation type here will NOT affect IP pool data.\n".
478 "</ul>\n";
479}
480
481
482# Stuff updates into DB
483sub update {
484 eval {
485 # Relatively simple SQL transaction here. Note that we're deliberately NOT
486 # updating notes/desc here as it's available through the main interface.
487 $sth = $ip_dbh->prepare("update allocations set custid='$webvar{custid}',".
488 "city='$webvar{city}',type='$webvar{alloctype}' where cidr='$webvar{block}'");
489 $sth->execute;
490 $ip_dbh->commit;
491 };
492 if ($@) {
493 carp "Transaction aborted because $@";
494 eval { $ip_dbh->rollback; };
495 syslog "err", "$authuser could not update block '$webvar{block}': '$@'";
496 } else {
497 # If we get here, the operation succeeded.
498 syslog "notice", "$authuser updated $webvar{block}";
499 print "Allocation $webvar{block} updated<hr>\n";
500 }
501 # need to get /24 that block is part of
502 my @bits = split /\./, $webvar{block};
503 $bits[3] = "0/24";
504 showAllocs((join ".", @bits));
505}
506
507
508# showPool()
509# List all IPs in a pool, and allow arbitrary admin changes to each
510# Allow changes to ALL fields
511sub showPool($) {
512 my $pool = new NetAddr::IP $_[0];
513 print qq(Listing pool $pool:\n<table border=1>
514<form action=admin.cgi method=POST>
515<input type=hidden name=action value=updatepool>
516<tr><td align=right>Customer ID:</td><td><input name=custid></td></tr>
517<tr><td align=right>Customer location:</td><td><input name=city></td></tr>
518<tr><td align=right>Type:</td><td><select name=type><option selected>-</option>\n);
519
520 $sth = $ip_dbh->prepare("select type,listname from alloctypes where type like '_i' order by listorder");
521 $sth->execute;
522 while (my @data = $sth->fetchrow_array) {
523 print "<option value='$data[0]'>$data[1]</option>\n";
524 }
525
526 print qq(</select></td></tr>
527<tr><td align=right>Available?</td><td><input type=checkbox value=y></td></tr>
528<tr><td align=right>Description/name:</td><td><input name=desc size=40></td></tr>
529<tr><td align=right>Notes:</td><td><textarea name=notes rows=3 cols=40></textarea></td></tr>
530<tr><td colspan=2 align=center><input type=submit value="Update"></td></tr>
531).
532 "</table>Update the following record:<table border=1>\n";
533 $sth = $ip_dbh->prepare("select pool,ip,custid,city,type,available,description,notes from poolips where pool='$pool' order by ip");
534 $sth->execute;
535 while (my @data = $sth->fetchrow_array) {
536 print qq(<tr><td><input type=radio name=ip value="$data[1]">$data[1]</td>).
537 "<td>$data[2]</td><td>$data[3]</td><td>$data[4]</td>".
538 "<td>$data[5]</td><td>$data[6]</td><td>$data[7]</td></tr>\n";
539 }
540 print "</form></table>\n";
541}
Note: See TracBrowser for help on using the repository browser.