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

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

[ History-conversion filler commit. Original log message: ]
/branches/stable

s/Billing Gateway/APEX/g

  • Property svn:executable set to *
  • Property svn:keywords set to Date Rev Author
File size: 20.0 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-05-24 14:43:05 +0000 (Wed, 24 May 2006) $
9# SVN revision $Rev: 338 $
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 billing.
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
398print qq(<hr><a href="/ip/">Back</a> to main interface</a>\n);
399
400printFooter;
401
402$ip_dbh->disconnect;
403
404exit;
405
406
407# Tweak allocfrom into shape.
408sub fix_allocfrom {
409 if ($webvar{allocfrom} =~ /^(\d+\.){2}\d+$/) {
410 # 3-octet class C specified
411 $webvar{allocfrom} .= ".0/24";
412 } elsif ($webvar{allocfrom} =~ /^(\d+\.){3}\d+$/) {
413 # 4-octet IP specified;
414 $webvar{allocfrom} .= "/24";
415 }
416}
417
418
419# List free blocks in a /24 for arbitrary manual allocation
420sub showfree($) {
421 my $cidr = new NetAddr::IP $_[0];
422 print "Showing free blocks in $cidr<br>\n".
423 "<table border=1>\n";
424 $sth = $ip_dbh->prepare("select * from freeblocks where cidr <<= '$cidr' order by cidr");
425 $sth->execute;
426 while (my @data = $sth->fetchrow_array) {
427 my $temp = new NetAddr::IP $data[0];
428 print "<tr><form action=admin.cgi method=POST><input type=hidden name=action value=assign>\n".
429 qq(<td>$temp<input type=hidden name=allocfrom value="$temp"></td>\n).
430 "<td>".
431 (($temp->masklen == 30) ? '<input type=hidden name=masklen value=30>30'
432 : "<select name=masklen><option>30</option>\n<option>29</option>\n") .
433 (($temp->masklen < 29) ? "<option>28</option>\n" : '') .
434 (($temp->masklen < 28) ? "<option>27</option>\n" : '') .
435 (($temp->masklen < 27) ? "<option>26</option>\n" : '') .
436 (($temp->masklen < 26) ? "<option>25</option>\n" : '') .
437 (($temp->masklen < 25) ? "<option>24</option>\n" : '') .
438 "</td>".
439 qq(<td>$data[2]</td><td><input type=submit value="Allocate from here"></td>).
440 "\n</form></tr>\n";
441 }
442 print "</table>\n";
443}
444
445
446# Show allocations to allow editing.
447sub showAllocs($) {
448 my $cidr = new NetAddr::IP $_[0];
449 print "Edit custID, allocation type, city for allocations in ".
450 "$cidr:\n<table border=1>";
451 $sth = $ip_dbh->prepare("select * from allocations where cidr <<= '$cidr' order by cidr");
452 $sth->execute;
453 while (my @data = $sth->fetchrow_array) {
454 print "<tr><form action=admin.cgi method=POST><input type=hidden name=action value=update>\n".
455 qq(<td>$data[0]<input type=hidden value="$data[0]" name=block></td>\n).
456 qq(<td><input name=custid value="$data[1]"></td>\n).
457 "<td><select name=alloctype>";
458
459 my $sth2 = $ip_dbh->prepare("select type,listname from alloctypes".
460 " where listorder < 500 and not (type like '_i') order by listorder");
461 $sth2->execute;
462 while (my @types = $sth2->fetchrow_array) {
463 print "<option". (($data[2] eq $types[0]) ? ' selected' : '') .
464 " value='$types[0]'>$types[1]</option>\n";
465 }
466 print "<option". (($data[2] eq 'in') ? ' selected' : '') .
467 " value='in'>Internal netblock</option>\n</select></td>\n";
468
469 print qq(<td><input name=city value="$data[3]"></td>\n).
470 "<td>$data[4]</td><td>$data[5]</td>".
471 qq(<td><input type=submit value="Update"></td></form></tr>\n);
472 }
473 print "</table>\n";
474
475 # notes
476 print "<hr><b>Notes:</b>\n".
477 "<ul>\n<li>Use the main interface to update description and notes fields\n".
478 "<li>Changing the allocation type here will NOT affect IP pool data.\n".
479 "</ul>\n";
480}
481
482
483# Stuff updates into DB
484sub update {
485 eval {
486 # Relatively simple SQL transaction here. Note that we're deliberately NOT
487 # updating notes/desc here as it's available through the main interface.
488 $sth = $ip_dbh->prepare("update allocations set custid='$webvar{custid}',".
489 "city='$webvar{city}',type='$webvar{alloctype}' where cidr='$webvar{block}'");
490 $sth->execute;
491 $ip_dbh->commit;
492 };
493 if ($@) {
494 carp "Transaction aborted because $@";
495 eval { $ip_dbh->rollback; };
496 syslog "err", "$authuser could not update block '$webvar{block}': '$@'";
497 } else {
498 # If we get here, the operation succeeded.
499 syslog "notice", "$authuser updated $webvar{block}";
500 print "Allocation $webvar{block} updated<hr>\n";
501 }
502 # need to get /24 that block is part of
503 my @bits = split /\./, $webvar{block};
504 $bits[3] = "0/24";
505 showAllocs((join ".", @bits));
506}
507
508
509# showPool()
510# List all IPs in a pool, and allow arbitrary admin changes to each
511# Allow changes to ALL fields
512sub showPool($) {
513 my $pool = new NetAddr::IP $_[0];
514 print qq(Listing pool $pool:\n<table border=1>
515<form action=admin.cgi method=POST>
516<input type=hidden name=action value=updatepool>
517<tr><td align=right>Customer ID:</td><td><input name=custid></td></tr>
518<tr><td align=right>Customer location:</td><td><input name=city></td></tr>
519<tr><td align=right>Type:</td><td><select name=type><option selected>-</option>\n);
520
521 $sth = $ip_dbh->prepare("select type,listname from alloctypes where type like '_i' order by listorder");
522 $sth->execute;
523 while (my @data = $sth->fetchrow_array) {
524 print "<option value='$data[0]'>$data[1]</option>\n";
525 }
526
527 print qq(</select></td></tr>
528<tr><td align=right>Available?</td><td><input type=checkbox value=y></td></tr>
529<tr><td align=right>Description/name:</td><td><input name=desc size=40></td></tr>
530<tr><td align=right>Notes:</td><td><textarea name=notes rows=3 cols=40></textarea></td></tr>
531<tr><td colspan=2 align=center><input type=submit value="Update"></td></tr>
532).
533 "</table>Update the following record:<table border=1>\n";
534 $sth = $ip_dbh->prepare("select pool,ip,custid,city,type,available,description,notes from poolips where pool='$pool' order by ip");
535 $sth->execute;
536 while (my @data = $sth->fetchrow_array) {
537 print qq(<tr><td><input type=radio name=ip value="$data[1]">$data[1]</td>).
538 "<td>$data[2]</td><td>$data[3]</td><td>$data[4]</td>".
539 "<td>$data[5]</td><td>$data[6]</td><td>$data[7]</td></tr>\n";
540 }
541 print "</form></table>\n";
542}
Note: See TracBrowser for help on using the repository browser.