From d5b6023c32b35333ceb427ed19814b02fe65d8e7 Mon Sep 17 00:00:00 2001 From: Stefan Schantl Date: Mon, 13 Apr 2020 09:45:38 +0200 Subject: [PATCH] ovpnclients.dat: Add table header. The header will be dynamically generated, according the items which will be displayed. Signed-off-by: Stefan Schantl Signed-off-by: Arne Fitzenreiter --- html/cgi-bin/logs.cgi/ovpnclients.dat | 48 +++++++++++++++++++-------- 1 file changed, 34 insertions(+), 14 deletions(-) diff --git a/html/cgi-bin/logs.cgi/ovpnclients.dat b/html/cgi-bin/logs.cgi/ovpnclients.dat index b601fd292..33d6d8717 100755 --- a/html/cgi-bin/logs.cgi/ovpnclients.dat +++ b/html/cgi-bin/logs.cgi/ovpnclients.dat @@ -243,7 +243,21 @@ my $lines = 0; print ""; -my $col=""; +my $col = "bgcolor='$color{'color20'}'"; + + print "\n"; + print "\n"; + + if ($cgiparams{'CONNECTION_NAME'}) { + print "\n"; + print "\n"; + print "\n"; + print "\n"; + } else { + print "\n"; while(my @row = $statement_handle->fetchrow_array()) { # Assign some nice to read variable names for the DB fields. @@ -253,23 +267,29 @@ while(my @row = $statement_handle->fetchrow_array()) { my $connection_bytes_recieved = &General::formatBytes($row[3]); my $connection_bytes_sent = &General::formatBytes($row[4]); - # Colorize columns. + # Colorize columns. if ($lines % 2) { - $col="bgcolor='$color{'color22'}'"; - } else { $col="bgcolor='$color{'color20'}'"; + } else { + $col="bgcolor='$color{'color22'}'"; } -print < - - - - - - -END -; + print "\n"; + print "\n"; + + if ($cgiparams{'CONNECTION_NAME'}) { + print "\n"; + print "\n"; + print "\n"; + print "\n"; + } else { + # Convert total connection time into human-readable format. + my $total_time = &General::format_time($row[1]); + + print "\n"; + } + + print "\n"; # Increase lines count. $lines++;
$Lang::tr{'ovpn connection name'}$Lang::tr{'connected'}$Lang::tr{'disconnected'}$Lang::tr{'recieved'}$Lang::tr{'sent'}$Lang::tr{'total connection time'}\n"; + } + + print "
$connection_name$connection_open_time$connection_close_time$connection_bytes_recieved$connection_bytes_sent
$connection_name$connection_open_time$connection_close_time$connection_bytes_recieved$connection_bytes_sent$total_time