diff --git a/hwe/join_post.php b/hwe/join_post.php index 85001276..76c155bf 100644 --- a/hwe/join_post.php +++ b/hwe/join_post.php @@ -8,7 +8,6 @@ $v = new Validator($_POST + $_GET); $v ->rule('required', [ 'name', - 'pic', 'leader', 'power', 'intel' @@ -18,7 +17,6 @@ $v 'power', 'intel', 'character', - 'pic' ]) ->rule('lengthBetween', 'name', 1, 6) ->rule('min', [ @@ -46,7 +44,7 @@ $userID = Session::getUserID(); $name = Util::getReq('name'); $name = StringUtil::removeSpecialCharacter($name); -$pic = Util::getReq('pic', 'int', 0); +$pic = (int)Util::getReq('pic', 'bool', 0); $character = Util::getReq('character', 'int', 0); $leader = Util::getReq('leader', 'int', 50); diff --git a/src/sammo/Util.php b/src/sammo/Util.php index 2f4cbf4a..2b0a3bce 100644 --- a/src/sammo/Util.php +++ b/src/sammo/Util.php @@ -34,7 +34,7 @@ class Util extends \utilphp\util if ($type === 'bool') { $value = strtolower($value); - if ($value === '' || $value === 'off' || $value === 'false' || $value === 'no' || $value === 'n' || $value === 'x' || $value === 'null') { + if ($value === null || $value === '' || $value === 'off' || $value === 'false' || $value === 'no' || $value === 'n' || $value === 'x' || $value === 'null') { return false; } return !!$value;