From 52956f8dabe840eba7ab24669fb28e2b2def9da1 Mon Sep 17 00:00:00 2001 From: Znote Date: Wed, 15 Dec 2021 23:23:24 +0100 Subject: [PATCH] Dont invoke IP validation if its disabled in config.php --- register.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/register.php b/register.php index b54a2b2..cd469a0 100644 --- a/register.php +++ b/register.php @@ -80,12 +80,14 @@ if (empty($_POST) === false) { if ($_POST['selected'] != 1) { $errors[] = 'You are only allowed to have an account if you accept the rules.'; } - if (validate_ip(getIP()) === false && $config['validate_IP'] === true) { - $errors[] = 'Failed to recognize your IP address. (Not a valid IPv4 address).'; + if ($config['validate_IP'] === true) { + if (validate_ip(getIP()) === false) { + $errors[] = 'Failed to recognize your IP address. (Not a valid IPv4 address).'; + } + } + if (strlen($_POST['flag']) < 1) { + $errors[] = 'Please choose country.'; } - if (strlen($_POST['flag']) < 1) { - $errors[] = 'Please choose country.'; - } } }