FALSE, 'incorrect_answer' => FALSE ]; // DonĀ“t run twice if (!isset($_POST['gateway_submit']) && !isset($_POST['register'])) { // Get some numbers up. Always keep an odd number to void 10-10 etc. $a = rand(11, 20); $b = rand(1, 10); $method = fusion_get_settings('gateway_method'); // 0 words, 1 numbers, 2 both if ($method == 0) { $antibot = intval($a + $b); $multiplier = "+"; $reply_method = $locale['gateway_062']; $a = convertNumberToWord($a); $antibot = convertNumberToWord($antibot); $_SESSION["antibot"] = strtolower($antibot); } else if ($method == 1) { $antibot = intval($a - $b); $multiplier = "-"; $reply_method = $locale['gateway_063']; $_SESSION["antibot"] = intval($antibot); $b = convertNumberToWord($b); } else { if ($a > 15) { $antibot = intval($a + $b); $multiplier = "+"; $reply_method = $locale['gateway_062']; $a = convertNumberToWord($a); $antibot = convertNumberToWord($antibot); $_SESSION["antibot"] = strtolower($antibot); } else { $antibot = intval($a - $b); $multiplier = "-"; $reply_method = $locale['gateway_063']; $_SESSION["antibot"] = intval($antibot); $b = convertNumberToWord($b); } } $a = str_rot47($a); $b = str_rot47($b); echo ""; // Just add fields to random $honeypot_array = [$locale['gateway_053'], $locale['gateway_054'], $locale['gateway_055'], $locale['gateway_056'], $locale['gateway_057'], $locale['gateway_058'], $locale['gateway_059']]; shuffle($honeypot_array); $_SESSION["honeypot"] = $honeypot_array[3]; // Try this and we see, Rot47 Encryption etc.. add_to_footer(''); $info = [ 'showform' => TRUE, 'gateway_question' => '', 'openform' => openform('Fusion_Gateway', 'post', 'register.php', ['class' => 'm-t-20']), 'closeform' => closeform(), 'hiddeninput' => form_hidden($honeypot_array[3], "", ""), 'textinput' => form_text('gateway_answer', "", "", ['error_text' => $locale['gateway_064'], 'required' => 1]), 'button' => form_button('gateway_submit', $locale['gateway_065'], $locale['gateway_065'], ['class' => 'btn-primary m-t-10']), ]; } if (isset($_POST['gateway_answer'])) { $honeypot = ''; if (isset($_SESSION["honeypot"])) { $honeypot = $_SESSION["honeypot"]; } $_SESSION["validated"] = "False"; if (isset($_POST["$honeypot"]) && $_POST["$honeypot"] == "") { $antibot = stripinput(strtolower($_POST["gateway_answer"])); if (isset($_SESSION["antibot"])) { if ($_SESSION["antibot"] == $antibot) { $_SESSION["validated"] = "True"; redirect(BASEDIR."register.php"); } else { $info['incorrect_answer'] = TRUE; } } } } if (!function_exists('display_gateway')) { function display_gateway($info) { global $locale; if ($info['showform'] == TRUE) { opentable($locale['gateway_069']); echo $info['openform']; echo $info['hiddeninput']; echo '

'.$info['gateway_question'].'

'; echo $info['textinput']; echo $info['button']; echo $info['closeform']; closetable(); } else if (!isset($_SESSION["validated"])) { echo '

'.$locale['gateway_068'].'

'; } if (isset($info['incorrect_answer']) && $info['incorrect_answer'] == TRUE) { opentable($locale['gateway_069']); echo '

'.$locale['gateway_066'].'

'; echo ''; closetable(); } } } display_gateway($info);