45 lines
1.2 KiB
Perl
45 lines
1.2 KiB
Perl
#!/bin/perl
|
|
use strict;
|
|
use mysql;
|
|
use CGI qw(:standard);
|
|
|
|
my $ind = param('ind');
|
|
my $del = param('del');
|
|
|
|
my $dbh = DBI->connect("DBI:mysql:database=c2;host=localhost",'root','', {RaiseError => 1});
|
|
|
|
print header();
|
|
print "<html>\n";
|
|
print "<head>\n";
|
|
print "<style type='text/css'>\n";
|
|
print "select { font-size:8pt }\n";
|
|
|
|
print "</style>\n";
|
|
|
|
print "</head>\n";
|
|
print "<body>\n";
|
|
print "<b><u>Host entfernen</u></b>\n";
|
|
if ($del eq "") {
|
|
my $sth = $dbh->prepare("select ind,description,hostname,ip from hosts order by 'hostname'");
|
|
$sth->execute;
|
|
print "<form action='del_host.pl'>\n";
|
|
print "<table>\n";
|
|
while (my $ref = $sth->fetchrow_arrayref()) {
|
|
print "<tr>\n";
|
|
print "<td><input type='radio' name='del' value='$ref->[0]'></td>\n";
|
|
print "<td><input type='text' readonly value='$ref->[1]'></td>\n";
|
|
print "<td><input type='text' readonly value='$ref->[2]'></td>\n";
|
|
print "<td><input type='text' readonly value='$ref->[3]'></td>\n";
|
|
print "</tr>\n";
|
|
}
|
|
print "<tr><td></td>\n<td><input type='submit' value='Löschen'></td></tr>\n";
|
|
print "</table>\n";
|
|
print "</form>\n";
|
|
}
|
|
else {
|
|
$dbh->do("delete from hosts where ind='$del'");
|
|
print "<br>Löschen durchgeführt!";
|
|
}
|
|
|
|
print "</body>\n";
|
|
print "</html>\n"; |