ovpnclients.dat: Do not perform DB actions if there is an error message.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
This commit is contained in:
Stefan Schantl
2020-04-13 09:45:42 +02:00
committed by Arne Fitzenreiter
parent 0f195a5305
commit e1cc1e6cb9

View File

@@ -140,11 +140,17 @@ if ($cgiparams{'CONNECTION_NAME'}) {
);
}
my $statement_handle;
my $database_return_value;
# Only process SQL actions if there is no error message.
unless ($errormessage) {
# Prepare SQL statement.
my $statement_handle = $database_handle->prepare($database_query);
$statement_handle = $database_handle->prepare($database_query);
# Execute SQL statement and get retun value if any error happened.
my $database_return_value = $statement_handle->execute();
$database_return_value = $statement_handle->execute();
}
# If an error has been returned, assign it to the errorstring value for displaying.
if($database_return_value < 0) {
@@ -264,6 +270,8 @@ my $col = "bgcolor='$color{'color20'}'";
print "</tr>\n";
# Only try to fetch the DB items if there is no error message.
unless ($errormessage) {
while(my @row = $statement_handle->fetchrow_array()) {
# Assign some nice to read variable names for the DB fields.
my $connection_name = $row[0];
@@ -299,6 +307,7 @@ while(my @row = $statement_handle->fetchrow_array()) {
# Increase lines count.
$lines++;
}
}
# If nothing has been fetched, the amount of lines is still zero.
# In this case display a hint about no data.