Jump to content

Spam field on registration form...


Kristoff

Recommended Posts

Hi guys, my client and I don't like or wish to use Captcha on the register form. Is it possible to add in a field to the registration form and check whether it's not empty and kill the registration? In cubecart.class.php on line 888 before:

// Check email is valid
				if (!filter_var($_POST['user']['email'], FILTER_VALIDATE_EMAIL)) {
					$errors['email'] = true;
					$error_messages[] = $GLOBALS['language']->common['error_email_invalid'];
				}

I've tried adding:

if ($_POST['user']['middlename'] != "") {
    die();
}

And then adding a hidden "middlename" field to the registration, but even if you complete middle name it lets you sign up.

 

Anyone got any ideas why my code isn't working?

 

Cheers

Link to comment
Share on other sites

In CC5213, line 888 is within the CubeCart->_checkout() function. This is not where you want to be if you are trying to catch bogus registrants.

 

I assume you have edited the template file content.register.php by adding the hidden field middlename. (We will assume your tactic is valid.)

 

In the file /classes/user.class.php, line 659 (CC5213), we test for an empty first_name, or an empty last_name. You can add your test after this for an existing middlename.

Link to comment
Share on other sites

  • 4 weeks later...

In CC5213, line 888 is within the CubeCart->_checkout() function. This is not where you want to be if you are trying to catch bogus registrants.

 

I assume you have edited the template file content.register.php by adding the hidden field middlename. (We will assume your tactic is valid.)

 

In the file /classes/user.class.php, line 659 (CC5213), we test for an empty first_name, or an empty last_name. You can add your test after this for an existing middlename.

 

Perfect, thank you.

 

As the field is not something anyone will ever see I simply added:

 

|| !empty($_POST['email1'])

To

if (empty($_POST['first_name']) || empty($_POST['last_name'])) {

And in my tests it seems to work. It does display "We need your name" error if the field is filled in, but that's fine as most people won't encounter it.

Link to comment
Share on other sites

  • 2 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...