added bot honeypot on signup

This commit is contained in:
2025-04-03 13:40:00 -06:00
parent 7eebc920a2
commit 4a79bb89d8
3 changed files with 18 additions and 2 deletions
+4
View File
@@ -641,3 +641,7 @@ input[type="file"] {
.tooltip:hover .tooltiptext { .tooltip:hover .tooltiptext {
visibility: visible; visibility: visible;
} }
#required_field {
display: none;
}
+12 -1
View File
@@ -111,6 +111,7 @@ function signup_form($error_msg = '')
<input type="hidden" name="crop_x" value="" id="crop_x"> <input type="hidden" name="crop_x" value="" id="crop_x">
<input type="hidden" name="crop_y" value="" id="crop_y"> <input type="hidden" name="crop_y" value="" id="crop_y">
<input type="hidden" name="crop_width" value="" id="crop_width"> <input type="hidden" name="crop_width" value="" id="crop_width">
<input name="required_field" id="required_field" value="">
<label for="username">Username</label> <label for="username">Username</label>
<input id="username" name="username" required> <input id="username" name="username" required>
@@ -151,8 +152,18 @@ function signup_form($error_msg = '')
return $form; return $form;
} }
function create_user($username, $email, $password, $verify_password, $role_id, $upload = null, $x = null, $y = null, $crop_width = null) function create_user($username, $email, $password, $verify_password, $role_id, $upload = null, $x = null, $y = null, $crop_width = null, $honeypot)
{ {
if (!empty($honeypot)) {
$error_msg = '
<div class="error">
You are a bot. Leave now.
</div>
';
return $error_msg;
}
if ($password != $verify_password) { if ($password != $verify_password) {
$error_msg = ' $error_msg = '
<div class="error"> <div class="error">
+2 -1
View File
@@ -18,7 +18,8 @@ if (isset($_POST['form_id'])) {
(!empty($_FILES) ? $_FILES : ''), (!empty($_FILES) ? $_FILES : ''),
(!empty($_POST['crop_x']) ? $_POST['crop_x'] : ''), (!empty($_POST['crop_x']) ? $_POST['crop_x'] : ''),
(!empty($_POST['crop_y']) ? $_POST['crop_y'] : ''), (!empty($_POST['crop_y']) ? $_POST['crop_y'] : ''),
(!empty($_POST['crop_width']) ? $_POST['crop_width'] : '') (!empty($_POST['crop_width']) ? $_POST['crop_width'] : ''),
$_POST['required_field']
); );
if ($msg === true) { if ($msg === true) {