Hello can some one help me with where i’m going wrong here… I’m building a cms as a hobbie/project and this is a common problem for me when working with forms. I have started to implement checking for errors first in my conditions but some conditions stopt working.
Where i have 3 inputs here i’m checking if any of the fields are empty before moving on down the script? Why is it not letting me check if any are not empty?
Also other functions like intval() have stopt working.
Any help is great please. Thank you.
if ($pageSubPage === 'secu') {
if (isset($_POST['edit_secuSettings-submit'])) {
$edit_loginfaillimit = filter_input(INPUT_POST, 'edit_loginfaillimit', FILTER_SANITIZE_STRING);
$edit_loginfailtime = filter_input(INPUT_POST, 'edit_loginfailtime', FILTER_SANITIZE_STRING);
$edit_allowregistration = filter_input(INPUT_POST, 'edit_allowregistration', FILTER_SANITIZE_STRING);
if (!empty($edit_loginfaillimit) || !empty($edit_loginfailtime) || !empty($edit_allowregistration)) {
$warning = 'you must change at least one of the fields to submit an update!';
} else if ($getUserPower < 9) {
$error = 'Access Denied! - Security';
header('Refresh: 2; '.$site_url.'?page=Admin');
} else if (!intval($edit_loginfaillimit) xor !intval($edit_loginfailtime) xor !intval($edit_allowregistration)) {
$error = 'Post Error!';
header('Refresh: 2; '.$site_url.'?page=Admin&sp=secu');
} else if (!$siteAdmin->updateSecuritySettings($edit_loginfaillimit, $edit_loginfailtime, $edit_allowregistration)) {
$error = 'SQL Error - The database was not updated!';
header('Refresh: 2; '.$site_url.'?page=Admin');
} else {
$success = 'The database has been updated!';
header('Refresh: 2; '.$site_url.'?page=Admin&sp=secu');
}
}
}