#!/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 "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "Todo entfernen\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 "
\n"; print "\n"; while (my $ref = $sth->fetchrow_arrayref()) { print "\n"; print "\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 "\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 "\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 "\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 "\n"; } #DESCRIPTION print "\n"; print "\n"; } print "\n\n"; print "
\n"; print "
\n"; } else { $dbh->do("delete from todos where ind='$del'"); print "
Löschen durchgeführt!"; } print "\n"; print "\n";