Skip to content

Commit 826d262

Browse files
author
Kristan Kenney
committed
Merge branch 'bugfix-firewall' into develop
2 parents 167b7a4 + 9389575 commit 826d262

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

web/add/firewall/banlist/index.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,6 @@
66
// Main include
77
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
88

9-
// Check token
10-
if ((!isset($_GET['token'])) || ($_SESSION['token'] != $_GET['token'])) {
11-
header('location: /login/');
12-
exit();
13-
}
14-
159
// Check user
1610
if ($_SESSION['user'] != 'admin') {
1711
header("Location: /list/user");
@@ -21,6 +15,12 @@
2115
// Check POST request
2216
if (!empty($_POST['ok'])) {
2317

18+
// Check token
19+
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
20+
header('location: /login/');
21+
exit();
22+
}
23+
2424
// Check empty fields
2525
if (empty($_POST['v_chain'])) $errors[] = __('banlist');
2626
if (empty($_POST['v_ip'])) $errors[] = __('ip address');
@@ -39,7 +39,7 @@
3939
$v_chain = escapeshellarg($_POST['v_chain']);
4040
$v_ip = escapeshellarg($_POST['v_ip']);
4141

42-
// Add firewall ban
42+
// Add firewall rule
4343
if (empty($_SESSION['error_msg'])) {
4444
exec (HESTIA_CMD."v-add-firewall-ban ".$v_ip." ".$v_chain, $output, $return_var);
4545
check_return_code($return_var,$output);
@@ -49,6 +49,7 @@
4949
// Flush field values on success
5050
if (empty($_SESSION['error_msg'])) {
5151
$_SESSION['ok_msg'] = __('BANLIST_CREATED_OK');
52+
unset($v_chain);
5253
unset($v_ip);
5354
}
5455
}

0 commit comments

Comments
 (0)