<![CDATA[ Honeypot Captcha + jot - MODX Community Forums]]> https://forums.modx.com/thread/?thread=19624 <![CDATA[Re: Honeypot Captcha + jot]]> https://forums.modx.com/thread/19624/honeypot-captcha-jot?page=2#dis-post-442935
i'm trying to fight off SPAM with my JOT forms and I'm wasn't able to get your code below to work. It seems that once I modify the jot.class.inc.php file the pages won't load. Wondering if there is something that I'm missing?

Open jot.class.inc.php and add this on line 547:

//-- Honeypot
if ($saveComment && !empty($_POST['body'])) {
    $this->form['error'] = 10;
    unset($pObj);
    return;
}


In jot template add this error: &10=I believe you're a bot

[+form.error:select=`
&-3=You are trying to re-submit the same post. You have probably clicked the submit button more than once.
&-2=Your comment has been rejected.
&-1=Your comment has been saved, it will first be reviewed before it is published.
&1=You are trying to re-submit the same post. You have probably clicked the submit button more than once.
&2=The security code you entered was incorrect.
&3=You can only post once each [+jot.postdelay+] seconds.
&4=Your comment has been rejected.
&5=[+form.errormsg:ifempty=`You didn't enter all the required fields`+]
&10=I believe you're a bot. 
`+]


And somewhere in the form the html for the honeypot field

<label id="bodyhp"><span>Body</span><br /> 
<input class="form-input" name="body" type="text" value="" id="body" />
</label>


Finally some CSS to hide the form:

label#bodyhp {
    display: block;
    height: 1px;
    overflow: hidden;
    padding-top: 1px;
}
]]>
taiyo1578 Nov 12, 2012, 12:03 PM https://forums.modx.com/thread/19624/honeypot-captcha-jot?page=2#dis-post-442935
<![CDATA[Re: Honeypot Captcha + jot]]> https://forums.modx.com/thread/19624/honeypot-captcha-jot?page=2#dis-post-108729 Extended by: Jelle Jager (TobyL) September 2006]]> bunk58 Feb 21, 2011, 12:15 PM https://forums.modx.com/thread/19624/honeypot-captcha-jot?page=2#dis-post-108729 <![CDATA[Re: Honeypot Captcha + jot]]> https://forums.modx.com/thread/19624/honeypot-captcha-jot#dis-post-108728 #EVAL - string of php code. Should return either true or false
deprecatedAlthough #EVAL still works in eForm 1.4 this rule will very likely no longer be supported in future versions. Use #FUNCTION instead.]]>
sottwell Feb 21, 2011, 10:30 AM https://forums.modx.com/thread/19624/honeypot-captcha-jot#dis-post-108728
<![CDATA[Re: Honeypot Captcha + jot]]> https://forums.modx.com/thread/19624/honeypot-captcha-jot#dis-post-108727
<input type="text" name="surname" id="surname" size="30" value="" autocomplete="off" eform="Surname::0:Must be a spam bot:#EVAL if(empty($_POST['surname']){return true;} else return false;" /> 

Seems to work okay]]>
bunk58 Feb 21, 2011, 09:40 AM https://forums.modx.com/thread/19624/honeypot-captcha-jot#dis-post-108727
<![CDATA[Re: Honeypot Captcha + jot]]> https://forums.modx.com/thread/19624/honeypot-captcha-jot#dis-post-108726 Sorry I hadn’t thought about looking in your Manager!]]> microcipcip Feb 21, 2011, 09:35 AM https://forums.modx.com/thread/19624/honeypot-captcha-jot#dis-post-108726 <![CDATA[Re: Honeypot Captcha + jot]]> https://forums.modx.com/thread/19624/honeypot-captcha-jot#dis-post-108725
The relevant form field:
<input tabindex="50" type="text" name="Last__Name" id="LastName" size=30 autocomplete="off" eform="LastName::0" />


The snippet call (of course, the functions could both be in one snippet and the snippet run via the &runSnippet parameter):
[!getServer!]
[!checkField!]
        [!eForm? &formid=`ContactForm` &tpl=`ContactForm` &report=`ContactReport` &to=`sottwell@sottwell.com` &subject=`sottwell.com Contact` &thankyou=`ThankYou` &from=`[+email+]` &fromname=`[+name+]` &replyto=`email` &eformOnBeforeMailSent=`getServer` &eformOnValidate=`checkField`!]


And the checkField function:
function checkField(&$fields,&$vMsg,&$rMsg) {
    if(!empty($fields['Last__Name'])) {
        return false;
    } else {
    return true;
    }
}

I’ve been suspecting for some time that I could use a regex validation field in the eform attribute of the snippet call, but I’ve been too busy/lazy to look into it.]]>
sottwell Feb 17, 2011, 03:28 AM https://forums.modx.com/thread/19624/honeypot-captcha-jot#dis-post-108725
<![CDATA[Re: Honeypot Captcha + jot]]> https://forums.modx.com/thread/19624/honeypot-captcha-jot#dis-post-108724 Quote from: sottwell at Feb 16, 2011, 08:02 PM

I’ve been using it with eForm for some time now with no complaints from clients and no spam from my contact form. I haven’t added it to my site’s Jot installation though.

Hi Susan, if you have time, can you share the eForm implementation of this?

Thanks in advance.]]>
microcipcip Feb 16, 2011, 05:48 PM https://forums.modx.com/thread/19624/honeypot-captcha-jot#dis-post-108724
<![CDATA[Re: Honeypot Captcha + jot]]> https://forums.modx.com/thread/19624/honeypot-captcha-jot#dis-post-108723
Open jot.class.inc.php and add this on line 547:
		//-- Honeypot
		if ($saveComment && !empty($_POST['body'])) {
			$this->form['error'] = 10;
			unset($pObj);
			return;
		}


In jot template add this error: &10=I believe you’re a bot
[+form.error:select=`
&-3=You are trying to re-submit the same post. You have probably clicked the submit button more than once.
&-2=Your comment has been rejected.
&-1=Your comment has been saved, it will first be reviewed before it is published.
&1=You are trying to re-submit the same post. You have probably clicked the submit button more than once.
&2=The security code you entered was incorrect.
&3=You can only post once each [+jot.postdelay+] seconds.
&4=Your comment has been rejected.
&5=[+form.errormsg:ifempty=`You didn't enter all the required fields`+]
&10=I believe you're a bot. 
`+]


And somewhere in the form the html for the honeypot field
    
    <label id="bodyhp"><span>Body</span><br /> 
    <input class="form-input" name="body" type="text" value="" id="body" />
    </label>


Finally some CSS to hide the form:
label#bodyhp {
    display: block;
    height: 1px;
    overflow: hidden;
    padding-top: 1px;
}
]]>
microcipcip Feb 16, 2011, 05:47 PM https://forums.modx.com/thread/19624/honeypot-captcha-jot#dis-post-108723
<![CDATA[Re: Honeypot Captcha + jot]]> https://forums.modx.com/thread/19624/honeypot-captcha-jot#dis-post-108722 sottwell Feb 16, 2011, 02:02 PM https://forums.modx.com/thread/19624/honeypot-captcha-jot#dis-post-108722 <![CDATA[Re: Honeypot Captcha + jot]]> https://forums.modx.com/thread/19624/honeypot-captcha-jot#dis-post-108721 ]]> markh Feb 16, 2011, 10:56 AM https://forums.modx.com/thread/19624/honeypot-captcha-jot#dis-post-108721