74 lines
2.2 KiB
Perl
74 lines
2.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>Todo entfernen</u></b>\n";
|
|
if ($del eq "") {
|
|
my $sth = $dbh->prepare("select ind,t_host,t_service,t_check,t_alert,t_description from todos order by 'ind'");
|
|
$sth->execute;
|
|
print "<form action='del_todo.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";
|
|
|
|
#HOST
|
|
my $sth_host = $dbh->prepare("select hostname,ip from hosts where ind='$ref->[1]'");
|
|
$sth_host->execute;
|
|
while (my $ref_host = $sth_host->fetchrow_arrayref()) {
|
|
print "<td><input type='text' readonly value='$ref_host->[0] ($ref_host->[1])'></td>\n";
|
|
}
|
|
|
|
#SERVICE
|
|
my $sth_desc = $dbh->prepare("select distinct description from services where service_ind='$ref->[2]'");
|
|
$sth_desc->execute;
|
|
while (my $ref_desc = $sth_desc->fetchrow_arrayref()) {
|
|
print "<td><input type='text' readonly value='$ref_desc->[0]'></td>\n";
|
|
}
|
|
|
|
#CHECK
|
|
my $sth_check = $dbh->prepare("select description from checks where ind='$ref->[3]'");
|
|
$sth_check->execute;
|
|
while (my $ref_check = $sth_check->fetchrow_arrayref()) {
|
|
print "<td><input type='text' readonly value='$ref_check->[0]'></td>\n";
|
|
}
|
|
|
|
#ALERT
|
|
my $sth_alert = $dbh->prepare("select description from alerts where ind='$ref->[4]'");
|
|
$sth_alert->execute;
|
|
while (my $ref_alert = $sth_alert->fetchrow_arrayref()) {
|
|
print "<td><input type='text' readonly value='$ref_alert->[0]'></td>\n";
|
|
}
|
|
|
|
#DESCRIPTION
|
|
print "<td><input type='text' readonly value='$ref->[5]'></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 todos where ind='$del'");
|
|
print "<br>Löschen durchgeführt!";
|
|
}
|
|
|
|
print "</body>\n";
|
|
print "</html>\n"; |