From 0f195a5305b1bfb2ea650e4a5079b446bb8ccc74 Mon Sep 17 00:00:00 2001 From: Stefan Schantl Date: Mon, 13 Apr 2020 09:45:41 +0200 Subject: [PATCH] ovpnclients.dat: Display error when the to date is not later than the from date. Signed-off-by: Stefan Schantl Signed-off-by: Arne Fitzenreiter --- html/cgi-bin/logs.cgi/ovpnclients.dat | 5 +++++ langs/en/cgi-bin/en.pl | 1 + 2 files changed, 6 insertions(+) diff --git a/html/cgi-bin/logs.cgi/ovpnclients.dat b/html/cgi-bin/logs.cgi/ovpnclients.dat index b84c2b8d7b..a83a0bca91 100755 --- a/html/cgi-bin/logs.cgi/ovpnclients.dat +++ b/html/cgi-bin/logs.cgi/ovpnclients.dat @@ -90,6 +90,11 @@ my $database_handle = DBI->connect("DBI:SQLite:dbname=$database", "", "", { Rais my $from_datestring = sprintf '%04d-%02d-%02d', ($cgiparams{"FROM_YEAR"}, $cgiparams{"FROM_MONTH"}, $cgiparams{"FROM_DAY"}); my $to_datestring = sprintf '%04d-%02d-%02d', ($cgiparams{"TO_YEAR"}, $cgiparams{"TO_MONTH"}, $cgiparams{"TO_DAY"}); +# Check if the to datestring is later than the from datestring. +unless ($to_datestring ge $from_datestring) { + $errormessage = "$Lang::tr{'error the to date has to be later than the from date'}"; +} + my $database_query = qq( SELECT common_name, SUM( diff --git a/langs/en/cgi-bin/en.pl b/langs/en/cgi-bin/en.pl index 95e25ae0cd..fb30bd69a3 100644 --- a/langs/en/cgi-bin/en.pl +++ b/langs/en/cgi-bin/en.pl @@ -1015,6 +1015,7 @@ 'error config' => 'Could not open /var/ipfire/ovpn/config/ZERINA.ovpn !', 'error external access' => 'Could not open /var/ipfire/xtaccess/config (external acccess could not be granted)!', 'error messages' => 'Error messages', +'error the to date has to be later than the from date' => 'The to date has to be later than the from date!', 'esp encryption' => 'ESP Encryption:', 'esp grouptype' => 'ESP Grouptype:', 'esp integrity' => 'ESP Integrity:', -- 2.39.2