Recommend this page to a friend! |
Download .zip |
Info | Documentation | View files (53) | Download .zip | Reputation | Support forum | Blog | Links |
Last Updated | Ratings | Unique User Downloads | Download Rankings | |||||
2024-03-08 (7 days ago) | Not enough user ratings | Total: 52 This week: 52 | All time: 10,588 This week: 1 |
Version | License | PHP version | Categories | |||
no-captcha-php 1.0 | BSD License | 5 | HTML, PHP 5, Validation, Security |
Description | Author | ||||||||
This package can validate human users who submit form fields. |
|
No Captcha Form Spam Filter is a PHP utility library for dealing with spam bots using unobtrusive and user friendly techniques.
Applying this techniques will help to reduce the span in your sites in more than 90% and users will not be annoyed with intrusive Captchas or extra fields.
You can download it and place it on your third party libraries folder but we highly recommend that you install it through composer.
Either run
$ composer require daxslab/no-captcha
or add
"daxslab/no-captcha": "~1.0"
to the require
section of your composer.json
file.
The NoCaptchaAntiSpam
Class can be used to declare Protection Rules,
Include security code in forms and check if the form submission does
not trigger any rule validation.
For creating an instance of the NoCaptchaAntiSpam
Class, the create()
static function can be used:
use daxslab\nocaptcha\NoCaptchaAntiSpam;
use daxslab\nocaptcha\rules\CssHiddenFieldRule;
// Declare no captcha anti spam object with CSS based hidden field check
$noCaptchaAntiSpam = NoCaptchaAntiSpam::create([
'rules' => [
CssHiddenFieldRule::create([
// form input field name
'name' => 'css_hidden_field',
])
],
]);
Using the NoCaptchaAntiSpam
created instance you can include the needed
elements inside a form with the renderRules()
function:
<form id="contactForm" method="post">
<div class="form-group">
<label for="contactName">Name</label>
<input class="form-control" name="contact_name" id="contactName" placeholder="Enter name">
</div>
<!-- Include rules form elements -->
<?= $noCaptchaAntiSpam->renderRules() ?>
<button type="submit" name="submit_button" class="btn btn-primary">Submit</button>
</form>
Using the checkSubmit()
function from the NoCaptchaAntiSpam
created
instance you can check if any of the declared Rules triggers when the
form is submitted:
if ($_POST){
if ($noCaptchaAntiSpam->checkSubmit()){
echo 'Form submitted correctly';
} else {
echo 'Bot detected';
}
}
Rule classes implements different security checks including:
A NoCaptchaAntiSpam
instance can contain one or multiple rules.
Random field names can be applied for an extra security layer, they are stored in PHP sessions and rules field names will change making difficult to bots identify them. Random field names can be applied to single rules or multiple rules.
For extended documentation and examples you can put the doc
folder
behind a PHP capable web server.
Files |
File | Role | Description | ||
---|---|---|---|---|
doc (10 files, 2 directories) | ||||
lib (1 file, 1 directory) | ||||
tests (3 files, 4 directories) | ||||
codeception.yml | Data | Auxiliary data | ||
composer.json | Data | Auxiliary data | ||
README.md | Doc. | Documentation |
Files | / | doc |
File | Role | Description | ||
---|---|---|---|---|
assets (2 directories) | ||||
common (2 files) | ||||
cookie_check.php | Example | Example script | ||
css_hidden_field_honeypot.php | Example | Example script | ||
form_time_trap.php | Example | Example script | ||
index.php | Aux. | Auxiliary script | ||
javascript_filled_input.php | Example | Example script | ||
javascript_generat..._field_honeypot.php | Example | Example script | ||
multiple_random_field_names.php | Example | Example script | ||
multiple_rules.php | Example | Example script | ||
random_field_name.php | Example | Example script | ||
session_time_trap.php | Example | Example script |
Files | / | doc | / | assets | / | css |
File | Role | Description |
---|---|---|
bootstrap.min.css | Data | Auxiliary data |
default.css | Data | Auxiliary data |
Files | / | doc | / | assets | / | js |
File | Role | Description |
---|---|---|
bootstrap.bundle.min.js | Data | Auxiliary data |
highlight.pack.js | Data | Auxiliary data |
jquery.slim.min.js | Data | Auxiliary data |
Files | / | doc | / | common |
File | Role | Description |
---|---|---|
footer.php | Aux. | Auxiliary script |
header.php | Aux. | Auxiliary script |
Files | / | lib | / | rules |
File | Role | Description |
---|---|---|
BaseRule.php | Class | Class source |
CookieCheckRule.php | Class | Class source |
CssHiddenFieldRule.php | Class | Class source |
FormTimeTrapRule.php | Class | Class source |
JavascriptFilledInputRule.php | Class | Class source |
JavascriptGeneratedHiddenFieldRule.php | Class | Class source |
RuleInterface.php | Class | Class source |
SessionTimeTrapRule.php | Class | Class source |
Files | / | tests |
File | Role | Description | ||
---|---|---|---|---|
acceptance (7 files) | ||||
acceptancenojs (4 files) | ||||
unit (2 files) | ||||
_support (4 files, 1 directory) | ||||
acceptance.suite.yml | Data | Auxiliary data | ||
acceptancenojs.suite.yml | Data | Auxiliary data | ||
unit.suite.yml | Data | Auxiliary data |
Files | / | tests | / | acceptance |
File | Role | Description |
---|---|---|
CookieCheckCest.php | Class | Class source |
CssHiddenFieldCest.php | Class | Class source |
FormBassedTimeTrapCest.php | Class | Class source |
HelloCest.php | Class | Class source |
JavascriptFilledInputCest.php | Class | Class source |
JavascriptGeneratedHiddenFieldCest.php | Class | Class source |
SessionBassedTimeTrapCest.php | Class | Class source |
Files | / | tests | / | acceptancenojs |
File | Role | Description |
---|---|---|
CssHiddenFieldNoJsCest.php | Class | Class source |
HelloNoJsCest.php | Class | Class source |
JavascriptFilledInputNoJsCest.php | Class | Class source |
JavascriptGenerate...enFieldNoJsCest.php | Class | Class source |
Files | / | tests | / | unit |
File | Role | Description |
---|---|---|
BaseRuleTest.php | Class | Class source |
NoCaptchaAntiSpamTest.php | Class | Class source |
Files | / | tests | / | _support |
File | Role | Description | ||
---|---|---|---|---|
Helper (4 files) | ||||
AcceptancenojsTester.php | Class | Class source | ||
AcceptanceTester.php | Class | Class source | ||
FunctionalTester.php | Class | Class source | ||
UnitTester.php | Class | Class source |
Files | / | tests | / | _support | / | Helper |
File | Role | Description |
---|---|---|
Acceptance.php | Class | Class source |
Acceptancenojs.php | Class | Class source |
Functional.php | Class | Class source |
Unit.php | Class | Class source |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.