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

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

/branches/stable

Bugfix for the bugfix in r292.

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