#!/usr/bin/perl -w

my $DBHOST = "localhost";
my $DBNAME = "temperature";

$webreport = "http://www.rotary.nu/temp/nattsjo_control/report.php?pw=$password";

use DBI;
use LWP::Simple;


if (exists($ARGV[1])) {
    my $id = int($ARGV[0]);
    my $method = int($ARGV[1]);

    my $sql = "INSERT INTO nattsjo_events_log VALUES (null, now(), $id, $method)";
#   print "$sql\n";

    my $db = DBI->connect("DBI:mysql:$DBNAME:$DBHOST", $DBUSER, $DBPASS);
    $DBI::result = $db->prepare($sql);
    $DBI::result->execute();
    undef $db;
    if ($webreport) {
	my $content = get($webreport . "&id=$id&method=$method");
    }
}