2017 © Pedro Peláez
 

library honeypot

This PHP library is used to manage honeypots in HTML forms. It will create the input form and do the necessary checks.

image

dominiquevienne/honeypot

This PHP library is used to manage honeypots in HTML forms. It will create the input form and do the necessary checks.

  • Friday, December 29, 2017
  • by dvienne
  • Repository
  • 2 Watchers
  • 6 Stars
  • 66 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 3 Forks
  • 1 Open issues
  • 16 Versions
  • 3 % Grown

The README.md

honeypot

This PHP library is used to manage honeypots in HTML forms. It will create the input form and do the necessary checks., (*1)

Installation

Go to you project root directory and use composer using this command, (*2)

composer require dominiquevienne/honeypot

Then create your application bootstrap using this kind of code, (*3)

inputs();
```
### Manual installation
- Download latest stable release on [Github](https://github.com/dominiquevienne/honeypot/releases)
- Uncompress the downloaded file
- Place content into your project
- Use similar code to load object
```php
inputs();
```
### Laravel
Using honeypot in Laravel is as simple as a
```
composer require dominiquevienne/honeypot
```
and add the following lines in your class
```php
inputs();
  }
}
```
### Drupal 8
First of all, go to your root directory of your Drupal 8 project and type
```
composer require dominiquevienne/honeypot
```
In the Form controller (where you build your form), add
```
use Dominiquevienne\Honeypot\Form;
```
in order to gain access to Honeypot Form constructor.

Instantiate your form using the ``drupalForm`` config array key set to ``TRUE``

Checks are done in the validate function using standard functions. 

## How it works
Once the package is installed the honeypot consists in enabling two steps
### Form rendering
Where you will trigger Form::timeCheck() which will store date-time of the Form rendering and trigger Form::honeypotInput() used to return the honeypot form element. 

Any of those two options are mandatory. 
```php
timeCheck();
$honeypotInputs = $oForm->inputs();
?>
<html>



<

form action="yourLandingPage.php" method="post">

<input type="submit"/>
</html>

Be aware that you'll need to hide the honeypot field. To do that, you'll have three solutions - use CSS (default class is hide) - remove the element from the DOM using JS (Pure Javascript, jQuery or other). This is already done by using default function $oForm->inputs() or by using $oForm->getHoneypotScript() which would return a script in pure javascript that would remove the honeypot field from the DOM., (*4)

Form action page

Before you do the real job in your script of the landing page of your form (action attribute of Form element), you will have to use this code, (*5)

<?php
$oHoneypot  = new Dominiquevienne\Honeypot\Honeypot();
$checks     = $oHoneypot->checks();
if(!empty($checks)) {
  die('Your are a spammer');
}
// your code

Available configuration

When you create the object, you have the ability to pass config values through an array., (*6)

<?php
$config = [
  'honeypotInputClass'  => 'myCssClass',
  'honeypotInputNames'  => [
    'name1',
    'name2',
  ],
  'formMethod'          => 'GET',
];
$oForm  = new Dominiquevienne\Honeypot\Form($config);

Form

honeypotInputMask

This is the mask used to render the input field. You can use Form::getHoneypotInputMask() to get the current value., (*7)

honeypotInputClass

This is the CSS class used on the honeypot input field., (*8)

honeypotInputType

This is the HTML type of the input field, (*9)

honeypotInputName

Way to force a specific name, (*10)

honeypotInputNames

Array containing a list in which honeypot will take a random name followed by a hash., (*11)

formMethod

HTTP Method used to send the form, (*12)

Honeypot

minFormCompletionTime

Time in seconds under which a form subscriber will be considered as a bot, (*13)

maxFailureAttempts

Quantity of accepted failures per session before considered as a bot. When the number is reached and failureCheck is ON, every attempt will be considered as a failure during all the session lifetime., (*14)

maxAttempts

Quantity of accepted attempts per session before considered as a bot. When the number is reached and quantityCheck is ON, every attempt will be considered as a failure during all the session lifetime., (*15)

checks

Array of checks to be made when submitting form. By default, checks are ['timeCheck','honeypotCheck','tokenCheck','failureCheck','quantityCheck'], (*16)

drupalForm

If set to TRUE, Form::inputs() will return a Drupal FAPI array instead of raw HTML, (*17)

The Versions

29/12 2017

dev-master

9999999-dev

This PHP library is used to manage honeypots in HTML forms. It will create the input form and do the necessary checks.

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

by Dominique Vienne

php form spam checks honeypot

31/08 2017

v3.1.1-stable

3.1.1.0

This PHP library is used to manage honeypots in HTML forms. It will create the input form and do the necessary checks.

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

by Dominique Vienne

php form spam checks honeypot

30/08 2017

v3.1-stable

3.1.0.0

This PHP library is used to manage honeypots in HTML forms. It will create the input form and do the necessary checks.

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

by Dominique Vienne

php form spam checks honeypot

30/08 2017

v3.0.1-stable

3.0.1.0

This PHP library is used to manage honeypots in HTML forms. It will create the input form and do the necessary checks.

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

by Dominique Vienne

php form spam checks honeypot

22/08 2017

v3.0-stable

3.0.0.0

This PHP library is used to manage honeypots in HTML forms. It will create the input form and do the necessary checks.

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

by Dominique Vienne

php form spam checks honeypot

21/08 2017

v2.1.4-stable

2.1.4.0

This PHP library is used to manage honeypots in HTML forms. It will create the input form and do the necessary checks.

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

by Dominique Vienne

php form spam checks honeypot

21/08 2017

v2.1.3-stable

2.1.3.0

This PHP library is used to manage honeypots in HTML forms. It will create the input form and do the necessary checks.

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

by Dominique Vienne

php form spam checks honeypot

17/08 2017

v2.1.2-stable

2.1.2.0

This PHP library is used to manage honeypots in HTML forms. It will create the input form and do the necessary checks.

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

by Dominique Vienne

php form spam checks honeypot

09/08 2017

v2.1.1-stable

2.1.1.0

This PHP library is used to manage honeypots in HTML forms. It will create the input form and do the necessary checks.

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

by Dominique Vienne

php form spam checks honeypot

08/08 2017

v2.1-stable

2.1.0.0

This PHP library is used to manage honeypots in HTML forms. It will create the input form and do the necessary checks.

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

by Dominique Vienne

php form spam checks honeypot

03/08 2017

v2.0-stable

2.0.0.0

This PHP library is used to manage honeypots in HTML forms. It will create the input form and do the necessary checks.

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

by Dominique Vienne

php form spam checks honeypot

03/08 2017

v1.4-stable

1.4.0.0

This PHP library is used to manage honeypots in HTML forms. It will create the input form and do the necessary checks.

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

by Dominique Vienne

php form spam checks honeypot

02/08 2017

v1.3-stable

1.3.0.0

This PHP library is used to manage honeypots in HTML forms. It will create the input form and do the necessary checks.

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

by Dominique Vienne

php form spam checks honeypot

28/06 2017

v1.2-stable

1.2.0.0

This PHP library is used to manage honeypots in HTML forms. It will create the input form and do the necessary checks.

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

by Dominique Vienne

php form spam checks honeypot

26/06 2017

v1.1-stable

1.1.0.0

This PHP library is used to manage honeypots in HTML forms. It will create the input form and do the necessary checks.

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

by Dominique Vienne

php form spam checks honeypot

26/06 2017

v1.0-stable

1.0.0.0

This PHP library is used to manage honeypots in HTML forms. It will create the input form and do the necessary checks.

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

by Dominique Vienne

php form spam checks honeypot