PHP code example of niirrty / niirrty.forms.security
1. Go to this page and download the library: Download niirrty/niirrty.forms.security library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
niirrty / niirrty.forms.security example snippets
use \Niirrty\Forms\Security\DynamicFormField;
$dynamicField = new DynamicFormField();
if ( $dynamicField->isValidRequest() )
{
// The field is permitted successful => handle the real form data
}
else
{
// No Request => show the form with the
use \Niirrty\Forms\Security\FormTimer;
// Init the form timer
$formTimer = new FormTimer(
true, // Use session?
'FormTimer.NameOfMyForm' // Session var name
);
// $isPostRequest is an imaginary value that must be replaced bei you're code to check if an POST request of
// you're form exists
if ( $isPostRequest )
{
if ( ! $formTimer->isValidRequest() )
{
// no valid Timer request => Ignore this request and show the form
}
else
{
// Handle the valid request
}
}
use \Niirrty\Forms\Security\HoneyPot;
$honeypot = new HoneyPot( 'fieldName', \INPUT_POST );
if ( $honeypot->isValidRequest() )
{
// The honeypot field is permitted successful => handle the real form data
}
else
{
// No Request => show the form with the at do not support CSS. e.g. "do not fill this field"
echo '<label class="inv1s1ble"&glt;&#80;l&#101;a&#115;e&#32;d&#111; &#110;o&#116; &#102;i&#108;l&#32;t&#104;i&#115; &#102;i&#101;l&#100;</label>';
// Example of output the
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.