#!/bin/perl
use strict;
use mysql;
use CGI qw(:standard);
my $ind = param('ind');
my $akt = param('akt');
my $deakt = param('deakt');
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 aktivieren/deaktivieren
\n";
if ($ind 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";
while (my $ref = $sth->fetchrow_arrayref()) {
print "\n";
}
print "
\n";
}
else {
#$dbh->do("delete from todos where ind='$del'");
if ($akt eq "aktivieren") {
$dbh->do("update todos set t_active = '1' where ind ='$ind'");
print "
Todo aktiviert!\n";
}
if ($deakt eq "deaktivieren") {
$dbh->do("update todos set t_active = '0' where ind ='$ind'");
print "
Todo deaktiviert!\n";
}
}
print "\n";
print "\n";