2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-12 16:46:35 +00:00

statistics2.cgi: code cleanup

git-svn-id: https://svn.fhem.de/fhem/trunk@14382 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
betateilchen 2017-05-26 11:39:53 +00:00
parent 1479b3d294
commit f88384da35

View File

@ -1,5 +1,10 @@
#!/usr/bin/perl -w
# $Id$
# ----------------------------------------
# database insert provided by betateilchen
# ----------------------------------------
#
use strict;
use warnings;
use Time::HiRes qw(time);
@ -18,23 +23,24 @@ sub add2total();
sub doAggregate();
sub viewStatistics();
my $start = time();
my $start = time(); # used for generation time calculation
my $ua = $ENV{HTTP_USER_AGENT};
$ua //= "";
my $geoip = $ENV{REMOTE_ADDR};
my %data = Vars();
# directory cointains databases
# database stuff
my $datadir = "./data";
my $dbf = "$datadir/fhem_statistics_2017.sqlite";
my $dsn = "dbi:SQLite:dbname=$dbf";
my $dbh;
my $sth;
my $css = "style.css";
my $limit = "datetime('now', '-12 months')";
#my $limit = "datetime('now', '-2 hour')";
# css stuff (to be changed for production use)
my $css = "style.css";
# ---------- decide task ----------