#!/bin/perl use Mysql; use strict; use CGI qw(:standard); my $save=param('save'); my $so = param('Sonntag'); my $mo = param('Montag'); my $di = param('Dienstag'); my $mi = param('Mittwoch'); my $don = param('Donnerstag'); my $fr = param('Freitag'); my $sa = param('Samstag'); print header(); print "\n"; print "\n"; print "\n"; print "\n"; my $dbh = DBI->connect("DBI:mysql:database=c2;host=localhost",'root','', {RaiseError => 1}); if ($save eq "") { print "
\n"; print "An welchen Tagen sollen Checks durchgeführt werden?\n"; print "\n"; my $sth = $dbh->prepare("select description,day,value from run_on order by 'day'"); $sth->execute; while (my $ref = $sth->fetchrow_arrayref()) { print "\n"; print "\n"; } print "
$ref->[0]"; if ($ref->[2] == '1') { print ""; } if ($ref->[2] == '0') { print ""; } print "
\n"; print "\n"; print "\n"; print "
\n"; } if ($save eq "save") { if ($so) { $dbh->do("update run_on set value = 1 where description = 'Sonntag'"); } else { $dbh->do("update run_on set value = 0 where description = 'Sonntag'"); } if ($mo) { $dbh->do("update run_on set value = 1 where description = 'Montag'"); } else { $dbh->do("update run_on set value = 0 where description = 'Montag'"); } if ($di) { $dbh->do("update run_on set value = 1 where description = 'Dienstag'"); } else { $dbh->do("update run_on set value = 0 where description = 'Dienstag'"); } if ($mi) { $dbh->do("update run_on set value = 1 where description = 'Mittwoch'"); } else { $dbh->do("update run_on set value = 0 where description = 'Mittwoch'"); } if ($don) { $dbh->do("update run_on set value = 1 where description = 'Donnerstag'"); } else { $dbh->do("update run_on set value = 0 where description = 'Donnerstag'"); } if ($fr) { $dbh->do("update run_on set value = 1 where description = 'Freitag'"); } else { $dbh->do("update run_on set value = 0 where description = 'Freitag'"); } if ($sa) { $dbh->do("update run_on set value = 1 where description = 'Samstag'"); } else { $dbh->do("update run_on set value = 0 where description = 'Samstag'"); } print "

Gespeichert\n"; } print "\n"; print "\n";