Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP

Edward C. Young
Edward C. Young
10,323 Points

Spam Checker - Validating Form Data

That Spam Checker looks quite effective. I have a question though. Consider the following field:

<tr style="display:none">
    <th><label for="spam">Address: </label></th>
    <td><input type="text" id="spam" name="spam" /></td>
</tr>

Does the programmer's logic here fool the bot still, or must I use some valid name to match the Label Text?

Edward C. Young
Edward C. Young
10,323 Points

Could I get a mod to move this to PHP > Build a Basic PHP Website > Adding a Basic Form > Validating Form Data? I think I erred when I tagged it PHP

1 Answer

Codin - Codesmite
Codin - Codesmite
8,600 Points

That wont work because you used a keyword bots can detect as a honeytrap "spam".

Call it something like "username" or "password" and the bot's will automatically fill data into the field.

Also do not declare "display:none" with inline CSS, most bots will detect this and know it is a honey trap as they detect human users cannot see the field so it is specifically there for them.

The best way is to disguise the rule in an unrelated class for example ".input" or something and it is also reccomended not to use "display:none", and instead use absolute positioning to position the element off of the page.

Edward C. Young
Edward C. Young
10,323 Points

Added CSS Class input-validation:

.input-validation {position: fixed; left: -999em; top: -999em; visibility: hidden;}

See also: Honeypot Positioning - StackOverflow.

Thanks