forked from HelgeSverre/SpamProtection
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.php
More file actions
35 lines (19 loc) · 1.21 KB
/
Copy pathexample.php
File metadata and controls
35 lines (19 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
use Helge\SpamProtection\SpamProtection;
use Helge\SpamProtection\Types;
require 'vendor/autoload.php';
$spamProtector = new SpamProtection(SpamProtection::THRESHOLD_STRICT, SpamProtection::TOR_DISALLOW);
var_dump($spamProtector->check(Types::EMAIL, "helge.sverre"));
var_dump($spamProtector->check(Types::IP, "8.8.8.8"));
var_dump($spamProtector->check(Types::USERNAME, "helgesverre"));
var_dump($spamProtector->checkEmail("helge.sverre@gmail.com"));
var_dump($spamProtector->checkIP("8.8.8.8"));
var_dump($spamProtector->checkUsername("spammer"));
var_dump($spamProtector->checkUsername("spammer2"));
var_dump($spamProtector->checkUsername("spammer3"));
var_dump($spamProtector->checkUsername("spammer4"));
/* Confidence Threshold */
// If the frequency is less than the frequency threshold - Return as not spam
// If the frequency is more than the frequency threshold, but the confidence is less than the confidence threshold - Return as not spam
// If the frequency is more than the frequency threshold and the confidence is more than the confidence threshold - Return as spam
$spamProtector = new SpamProtection(SpamProtection::THRESHOLD_STRICT, SpamProtection::TOR_DISALLOW, null, SpamProtection::CONFIDENCE_LOW);