Example #1
0
<?php

require_once "../../../AntiSpam.class.php";
$object = new AntiSpam();
if ($object->check('example', $_GET['code'])) {
    echo "Good value :-)";
} else {
    echo "Bad value :-(";
}
        {
            $message = '<div class="error">'.$langs->trans("ErrorFailedToValidatePassword").'</div>';
        }
    }
}
// Action modif mot de passe
if ($action == 'buildnewpassword' && $username)
{
    require_once DOL_DOCUMENT_ROOT.'/includes/artichow/Artichow.cfg.php';
    require_once ARTICHOW."/AntiSpam.class.php";

    // We create anti-spam object
    $object = new AntiSpam();

    // Verify code
    if (! $object->check('dol_antispam_value',$_POST['code'],true))
    {
        $message = '<div class="error">'.$langs->trans("ErrorBadValueForCode").'</div>';
    }
    else
    {
        $edituser = new User($db);
        $result=$edituser->fetch('',$username,'',1);
        if ($result <= 0 && $edituser->error == 'USERNOTFOUND')
        {
            $message = '<div class="error">'.$langs->trans("ErrorLoginDoesNotExists",$username).'</div>';
            $username='';
        }
        else
        {
            if (! $edituser->email)
<?php

require_once '../AntiSpam.class.php';
$span = new AntiSpam();
ob_start();
assert($span->check('test', 'TeST It!') === TRUE);
assert($span->check('test', 'TeST iT!', FALSE) === FALSE);
assert($span->check('test', 'test it!', TRUE) === TRUE);
$data = ob_get_clean();
if ($data === '') {
    echo "All tests passed!";
} else {
    echo "Some errors have occur:<br/>";
    echo $data;
}
echo "<ul>\n\t<li><a href='AntiSpam.php'>Previous page</a></li>\n</ul>";