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

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

/branches/stable

Bugfix for broken "Allocate *THIS* IP" functionality in admin tools

  • 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:15:48 +0000 (Fri, 14 Oct 2005) $
9# SVN revision $Rev: 292 $
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",
228 "$disp_alloctypes{$webvar{alloctype}} $msg allocated to customer $webvar{custid}\n".
229 "Description: $webvar{desc}\n\nAllocated by: $authuser\n");
230 }
231 } else {
232 my ($retcode,$msg) = allocateBlock($ip_dbh, $webvar{cidr}, $webvar{alloc_from},
[200]233 $webvar{custid}, $webvar{alloctype}, $webvar{city}, $webvar{desc}, $webvar{notes},
234 $webvar{circid});
[292]235 if ($retcode eq 'OK') {
236 print "Allocation OK!\n";
237 syslog "notice", "$authuser allocated '$webvar{cidr}' to '$webvar{custid}' as ".
238 "'$webvar{alloctype}'";
239 } else {
240 print "Allocation failed! IPDB::allocateBlock said:\n$msg\n";
241 syslog "err", "($authuser) Allocation of '$webvar{cidr}' to '$webvar{custid}' as ".
242 "'$webvar{alloctype}' failed: '$msg'";
243 }
244 } # static IP vs netblock
[200]245
246 } # done city check
247
[54]248} elsif ($webvar{action} eq 'alloctweak') {
249 fix_allocfrom();
250 showAllocs($webvar{allocfrom});
251} elsif ($webvar{action} eq 'update') {
252 update();
[58]253} elsif ($webvar{action} eq 'assign') {
254 # Display a list of possible blocks within the requested block.
255 open (HTML, "../admin_alloc.html")
256 or croak "Could not open admin_alloc.html :$!";
257 my $html = join('', <HTML>);
258 $html =~ s/\$\$MASK\$\$/$webvar{masklen}/g;
259 $html =~ s/\$\$ALLOCFROM\$\$/$webvar{allocfrom}/g;
260
261 my $from = new NetAddr::IP $webvar{allocfrom};
262 my @blocklist = $from->split($webvar{masklen});
263 my $availblocks;
264 foreach (@blocklist) {
265 $availblocks .= qq(<tr><td colspan=2 align=center><input type=radio name=block value="$_">$_</td></tr>\n);
266 }
267 $html =~ s/\$\$BLOCKLIST\$\$/$availblocks/g;
268
269 print $html;
[200]270} elsif ($webvar{action} eq 'showpools') {
271 print "IP Pools currently allocated:\n".
272 "<table border=1>\n<tr><td>Pool</td><td># of free IPs</td></tr>\n";
273 $sth = $ip_dbh->prepare("select cidr from allocations where type like '%p' or type like '%d' order by cidr");
274 $sth->execute;
275 my %poolfree;
276 while (my @data = $sth->fetchrow_array) {
277 $poolfree{$data[0]} = 0;
278 }
279 $sth = $ip_dbh->prepare("select pool,ip from poolips where available='y' order by ip");
280 $sth->execute;
281 while (my @data = $sth->fetchrow_array) {
282 $poolfree{$data[0]}++;
283 }
284 foreach my $key (keys %poolfree) {
285 print qq(<tr><td><a href="admin.cgi?action=tweakpool&pool=$key">$key</a></td>).
286 "<td>$poolfree{$key}</td></tr>\n";
287 }
288 print "</table>\n";
289} elsif ($webvar{action} eq 'tweakpool') {
290 showPool($webvar{pool});
291} elsif ($webvar{action} eq 'updatepool') {
292
293 $sth = $ip_dbh->prepare("update poolips set custid='$webvar{custid}', ".
294 "city='$webvar{city}', type='$webvar{type}', available='".
295 (($webvar{available} eq 'y') ? 'y' : 'n').
296 "', notes='$webvar{notes}', description='$webvar{desc}' ".
297 "where ip='$webvar{ip}'");
298 $sth->execute;
299 if ($sth->err) {
300 print "Error updating pool IP $webvar{ip}: $@<hr>\n";
301 syslog "err", "$authuser could not update pool IP $webvar{ip}: $@";
302 } else {
303 $sth = $ip_dbh->prepare("select pool from poolips where ip='$webvar{ip}'");
304 $sth->execute;
305 my @data = $sth->fetchrow_array;
306 print "$webvar{ip} in $data[0] updated\n<hr>\n";
307 syslog "notice", "$authuser updated pool IP $webvar{ip}";
308 }
[260]309} elsif ($webvar{action} eq 'showusers') {
[242]310 print "Notes:<br>\n".
[260]311 "<li>Admin users automatically get all other priviledges.\n".
312 "<hr>Add new user:<form action=admin.cgi method=POST>\n".
313 "Username: <input name=username><br>\n".
314 "Password: <input name=password> <input type=checkbox name=preenc>Password is pre-encrypted (MUST be crypt() encrypted)<br>\n".
315 "<input type=submit value='Add user'><input type=hidden name=action value=newuser></form>\n";
[242]316
317 print "<hr>Users with access:\n<table border=1>\n";
[286]318 print "<tr><td></td><td align=center colspan=3>General access</td></tr>\n";
[242]319 print "<tr><td>Username</td><td>Add new</td><td>Change</td>".
[286]320 "<td>Delete</td><td>Systems/Networking</td><td>Admin user</td></tr>\n".
[242]321 "<form action=admin.cgi method=POST>\n";
322 $sth = $ip_dbh->prepare("select username,acl from users order by username");
323 $sth->execute;
324 while (my @data = $sth->fetchrow_array) {
325 print "<form action=admin.cgi method=POST><input type=hidden name=action value=updacl>".
326 qq(<tr><td>$data[0]<input type=hidden name=username value="$data[0]"></td><td>).
327 # Now for the fun bit. We have to pull apart the ACL field and
328 # output a bunch of checkboxes.
329 "<input type=checkbox name=add".($data[1] =~ /a/ ? ' checked=y' : '').
330 "></td><td><input type=checkbox name=change".($data[1] =~ /c/ ? ' checked=y' : '').
331 "></td><td><input type=checkbox name=del".($data[1] =~ /d/ ? ' checked=y' : '').
[286]332 "></td><td><input type=checkbox name=sysnet".($data[1] =~ /s/ ? ' checked=y' : '').
[242]333 "></td><td><input type=checkbox name=admin".($data[1] =~ /A/ ? ' checked=y' : '').
[260]334 qq(></td><td><input type=submit value="Update"></td></form>\n).
335 "<form action=admin.cgi method=POST><td><input type=hidden name=action value=deluser>".
336 "<input type=hidden name=username value=$data[0]>".
337 qq(<input type=submit value="Delete user"></tr></form>\n);
[242]338
339 }
340 print "</table>\n";
341} elsif ($webvar{action} eq 'updacl') {
342 print "Updating ACL for $webvar{username}:<br>\n";
343 my $acl = 'b';
344 if ($webvar{admin} eq 'on') {
[286]345 $acl .= "acdsA";
[242]346 } else {
347 $acl .= ($webvar{add} eq 'on' ? 'a' : '').
348 ($webvar{change} eq 'on' ? 'c' : '').
[286]349 ($webvar{del} eq 'on' ? 'd' : '').
350 ($webvar{sysnet} eq 'on' ? 's' : '');
[242]351 }
352 print "New ACL: $acl<br>\n";
353
354 $sth = $ip_dbh->prepare("update users set acl='$acl' where username='$webvar{username}'");
355 $sth->execute;
356 print "OK\n" if !$sth->err;
357
[260]358 print qq(<hr><a href="admin.cgi?action=showusers">Back</a> to user listing\n);
[242]359
[260]360} elsif ($webvar{action} eq 'newuser') {
361 print "Adding user $webvar{username}...\n";
362 my $cr_pass = ($webvar{preenc} ? $webvar{password} :
363 crypt $webvar{password}, join('',('.','/',0..9,'A'..'Z','a'..'z')[rand 64, rand 64]));
364 $sth = $ip_dbh->prepare("insert into users (username,password,acl) values ".
365 "('$webvar{username}','$cr_pass','b')");
366 $sth->execute;
367 if ($sth->err) {
368 print "<br>Error adding user: ".$sth->errstr;
369 } else {
370 print "OK\n";
371 }
372
373 print qq(<hr><a href="admin.cgi?action=showusers">Back</a> to user listing\n);
374
375} elsif ($webvar{action} eq 'deluser') {
376 print "Deleting user $webvar{username}.<br>\n";
377 $sth = $ip_dbh->prepare("delete from users where username='$webvar{username}'");
378 $sth->execute;
379 print "OK\n" if !$sth->err;
380
381 print qq(<hr><a href="admin.cgi?action=showusers">Back</a> to user listing\n);
382
[242]383} elsif ($webvar{action} ne '<NULL>') {
384 print "webvar{action} check failed: Don't know how to $webvar{action}";
[54]385}
386
387# Hokay. This is a little different. We have a few specific functions here:
388# -> Assign arbitrary subnet from arbitrary free space
389# -> Tweak individual DB fields
390#
391
392
393printFooter;
394
395$ip_dbh->disconnect;
396
397exit;
398
399
400# Tweak allocfrom into shape.
401sub fix_allocfrom {
402 if ($webvar{allocfrom} =~ /^(\d+\.){2}\d+$/) {
403 # 3-octet class C specified
404 $webvar{allocfrom} .= ".0/24";
405 } elsif ($webvar{allocfrom} =~ /^(\d+\.){3}\d+$/) {
406 # 4-octet IP specified;
407 $webvar{allocfrom} .= "/24";
408 }
409}
410
411
[58]412# List free blocks in a /24 for arbitrary manual allocation
413sub showfree($) {
414 my $cidr = new NetAddr::IP $_[0];
415 print "Showing free blocks in $cidr<br>\n".
416 "<table border=1>\n";
417 $sth = $ip_dbh->prepare("select * from freeblocks where cidr <<= '$cidr' order by cidr");
418 $sth->execute;
419 while (my @data = $sth->fetchrow_array) {
420 my $temp = new NetAddr::IP $data[0];
421 print "<tr><form action=admin.cgi method=POST><input type=hidden name=action value=assign>\n".
422 qq(<td>$temp<input type=hidden name=allocfrom value="$temp"></td>\n).
423 "<td>".
424 (($temp->masklen == 30) ? '<input type=hidden name=masklen value=30>30'
425 : "<select name=masklen><option>30</option>\n<option>29</option>\n") .
426 (($temp->masklen < 29) ? "<option>28</option>\n" : '') .
427 (($temp->masklen < 28) ? "<option>27</option>\n" : '') .
428 (($temp->masklen < 27) ? "<option>26</option>\n" : '') .
429 (($temp->masklen < 26) ? "<option>25</option>\n" : '') .
430 (($temp->masklen < 25) ? "<option>24</option>\n" : '') .
431 "</td>".
432 qq(<td>$data[2]</td><td><input type=submit value="Allocate from here"></td>).
433 "\n</form></tr>\n";
434 }
435 print "</table>\n";
436}
437
438
[54]439# Show allocations to allow editing.
440sub showAllocs($) {
441 my $cidr = new NetAddr::IP $_[0];
442 print "Edit custID, allocation type, city for allocations in ".
443 "$cidr:\n<table border=1>";
444 $sth = $ip_dbh->prepare("select * from allocations where cidr <<= '$cidr' order by cidr");
445 $sth->execute;
446 while (my @data = $sth->fetchrow_array) {
447 print "<tr><form action=admin.cgi method=POST><input type=hidden name=action value=update>\n".
448 qq(<td>$data[0]<input type=hidden value="$data[0]" name=block></td>\n).
[269]449 qq(<td><input name=custid value="$data[1]"></td>\n).
450 "<td><select name=alloctype>";
[54]451
[269]452 my $sth2 = $ip_dbh->prepare("select type,listname from alloctypes".
453 " where listorder < 500 and not (type like '_i') order by listorder");
454 $sth2->execute;
455 while (my @types = $sth2->fetchrow_array) {
456 print "<option". (($data[2] eq $types[0]) ? ' selected' : '') .
457 " value='$types[0]'>$types[1]</option>\n";
458 }
459 print "<option". (($data[2] eq 'in') ? ' selected' : '') .
460 " value='in'>Internal netblock</option>\n</select></td>\n";
461
[54]462 print qq(<td><input name=city value="$data[3]"></td>\n).
463 "<td>$data[4]</td><td>$data[5]</td>".
464 qq(<td><input type=submit value="Update"></td></form></tr>\n);
465 }
466 print "</table>\n";
467
468 # notes
469 print "<hr><b>Notes:</b>\n".
470 "<ul>\n<li>Use the main interface to update description and notes fields\n".
471 "<li>Changing the allocation type here will NOT affect IP pool data.\n".
472 "</ul>\n";
473}
474
475
476# Stuff updates into DB
477sub update {
478 eval {
479 # Relatively simple SQL transaction here. Note that we're deliberately NOT
480 # updating notes/desc here as it's available through the main interface.
481 $sth = $ip_dbh->prepare("update allocations set custid='$webvar{custid}',".
482 "city='$webvar{city}',type='$webvar{alloctype}' where cidr='$webvar{block}'");
483 $sth->execute;
484 $ip_dbh->commit;
485 };
486 if ($@) {
487 carp "Transaction aborted because $@";
488 eval { $ip_dbh->rollback; };
[200]489 syslog "err", "$authuser could not update block '$webvar{block}': '$@'";
[54]490 } else {
491 # If we get here, the operation succeeded.
492 syslog "notice", "$authuser updated $webvar{block}";
493 print "Allocation $webvar{block} updated<hr>\n";
494 }
495 # need to get /24 that block is part of
496 my @bits = split /\./, $webvar{block};
497 $bits[3] = "0/24";
498 showAllocs((join ".", @bits));
499}
[200]500
501
502# showPool()
503# List all IPs in a pool, and allow arbitrary admin changes to each
504# Allow changes to ALL fields
505sub showPool($) {
506 my $pool = new NetAddr::IP $_[0];
507 print qq(Listing pool $pool:\n<table border=1>
508<form action=admin.cgi method=POST>
509<input type=hidden name=action value=updatepool>
510<tr><td align=right>Customer ID:</td><td><input name=custid></td></tr>
511<tr><td align=right>Customer location:</td><td><input name=city></td></tr>
[269]512<tr><td align=right>Type:</td><td><select name=type><option selected>-</option>\n);
513
514 $sth = $ip_dbh->prepare("select type,listname from alloctypes where type like '_i' order by listorder");
515 $sth->execute;
516 while (my @data = $sth->fetchrow_array) {
517 print "<option value='$data[0]'>$data[1]</option>\n";
518 }
519
520 print qq(</select></td></tr>
[200]521<tr><td align=right>Available?</td><td><input type=checkbox value=y></td></tr>
522<tr><td align=right>Description/name:</td><td><input name=desc size=40></td></tr>
523<tr><td align=right>Notes:</td><td><textarea name=notes rows=3 cols=40></textarea></td></tr>
524<tr><td colspan=2 align=center><input type=submit value="Update"></td></tr>
525).
526 "</table>Update the following record:<table border=1>\n";
527 $sth = $ip_dbh->prepare("select pool,ip,custid,city,type,available,description,notes from poolips where pool='$pool' order by ip");
528 $sth->execute;
529 while (my @data = $sth->fetchrow_array) {
530 print qq(<tr><td><input type=radio name=ip value="$data[1]">$data[1]</td>).
531 "<td>$data[2]</td><td>$data[3]</td><td>$data[4]</td>".
532 "<td>$data[5]</td><td>$data[6]</td><td>$data[7]</td></tr>\n";
533 }
534 print "</form></table>\n";
535}
Note: See TracBrowser for help on using the repository browser.