コード例 #1
0
 public function catpcha()
 {
     JpGraph\JpGraph::load();
     JpGraph\JpGraph::module('antispam');
     $spam = new AntiSpam();
     $_SESSION['catpcha'] = $spam->Rand(6);
     $spam->Stroke();
 }
コード例 #2
0
        $headers = 'MIME-Version: 1.0' . "\r\n";
        $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
        $headers .= 'From: marcz@lab1521.com' . "\r\n";
        return mail($this->email, $this->subject, $this->message, $headers);
    }
}
$emailTemplate = '<table>
        <tr><th>First Name</th><td>{{nameFirst}}</td></tr>
        <tr><th>Last Name</th><td>{{nameLast}}</td></tr>
        <tr><th>Email</th><td>{{email}}</td></tr>
        <tr><th>Phone</th><td>{{phone}}</td></tr>
        <tr><th>Message</th><td></td></tr>
        <tr><td colspan="2">{{message}}</td></tr>
    </table>
    ';
$antiSpam = new AntiSpam();
$mailer = new Mailer();
$mailer->to('*****@*****.**');
$mailer->subject('Online Enquiry To VineyardForSale');
$mailer->setTemplate($emailTemplate);
if (isset($_POST['antiSpamAnswer']) && isset($_POST['antiSpamToken'])) {
    $form = new ContactForm();
    $form->setFields(array('nameFirst' => 'required|sanitize', 'nameLast' => 'required|sanitize', 'email' => 'required|email', 'phone' => 'required|sanitize', 'message' => 'required|sanitize', 'antiSpamAnswer' => 'required|sanitize', 'antiSpamToken' => 'required|sanitize'));
    $form->setSource($_POST);
    $form->setFilter(array($antiSpam, 'answer'), array('antiSpamAnswer', 'antiSpamToken'));
    $validation = $form->validate();
    if ($validation['success']) {
        $mailer->fillTemplate($form->getFields());
        $mailer->send();
    }
    JSON::output($validation);
コード例 #3
0
<?php

// Antispam example using a random string
require_once "../jpgraph_antispam.php";
// Create new anti-spam challenge creator
// Note: Neither '0' (digit) or 'O' (letter) can be used to avoid confusion
$spam = new AntiSpam();
// Create a random 5 char challenge and return the string generated
$chars = $spam->Rand(5);
// Stroke random cahllenge
if ($spam->Stroke() === false) {
    die('Illegal or no data to plot');
}
?>

コード例 #4
0
ファイル: register.php プロジェクト: BackupTheBerlios/qsf-svn
 function create_image()
 {
     // Need to get rid of other image files since the names will all be different now.
     foreach (glob("./stats/*.png") as $filename) {
         unlink($filename);
     }
     require './lib/jpgraph/jpgraph.php';
     require './lib/jpgraph/jpgraph_antispam.php';
     if (!function_exists('imagejpeg')) {
         JpGraphError::Raise("This PHP installation is not configured with JPEG support. Please recompile PHP with GD and JPEG support to run JpGraph. (Function imagejpeg() does not exist)");
     }
     $graph = new AntiSpam();
     $text = strtoupper($graph->Rand(6));
     $filename = "./stats/register" . $this->time . ".png";
     $graph->Stroke($filename);
     return array(md5("{$this->sets['db_pass']}{$this->sets['mostonlinetime']}{$text}"), $filename);
 }
コード例 #5
0
<?php

/*
 * This work is hereby released into the Public Domain.
 * To view a copy of the public domain dedication,
 * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to
 * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
 *
 */
require_once "../AntiSpam.class.php";
$object = new AntiSpam();
$object->setRand(5);
$object->save('example');
$object->draw();
コード例 #6
0
            exit;
        }
        else
        {
            $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='';
        }
コード例 #7
0
ファイル: captcha.php プロジェクト: Danipes2/proyecto
<?php

include "../funciones/inc/jpgraph_antispam-digits.php";
session_start();
$spam = new AntiSpam();
$chars = $spam->Rand(6);
$_SESSION['tmptxt'] = $chars;
$spam->Stroke();
コード例 #8
0
<?php

/*
 * This work is hereby released into the Public Domain.
 * To view a copy of the public domain dedication,
 * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to
 * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
 *
 */
require_once "../../AntiSpam.class.php";
$object = new AntiSpam('test it!');
$object->save('test');
$object->draw();
コード例 #9
0
ファイル: valid.php プロジェクト: BackupTheBerlios/horux-svn
<?php

require_once "../../../AntiSpam.class.php";
$object = new AntiSpam();
if ($object->check('example', $_GET['code'])) {
    echo "Good value :-)";
} else {
    echo "Bad value :-(";
}
コード例 #10
0
<?php

/*
 * This work is hereby released into the Public Domain.
 * To view a copy of the public domain dedication,
 * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to
 * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
 *
 */
require_once "../../AntiSpam.class.php";
$object = new AntiSpam();
$object->setRand(mt_rand(0, 15));
$object->setNoise(mt_rand(0, 10));
$object->draw();
コード例 #11
0
<?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>";
コード例 #12
0
<?php

/*
 * This work is hereby released into the Public Domain.
 * To view a copy of the public domain dedication,
 * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to
 * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
 *
 */
require_once "../../AntiSpam.class.php";
$object = new AntiSpam();
$object->setRand(mt_rand(5, 10));
$object->setBackgroundColor(new Color(mt_rand(220, 240), mt_rand(220, 240), mt_rand(220, 240)));
$object->draw();
コード例 #13
0
ファイル: register.php プロジェクト: BackupTheBerlios/qsf-svn
 function create_image()
 {
     require './lib/jpgraph/jpgraph.php';
     require './lib/jpgraph/jpgraph_antispam.php';
     if (!function_exists('imagejpeg')) {
         JpGraphError::Raise("This PHP installation is not configured with JPEG support. Please recompile PHP with GD and JPEG support to run JpGraph. (Function imagejpeg() does not exist)");
     }
     $graph = new AntiSpam();
     $text = $graph->Rand(6);
     $graph->Stroke('./register.png');
     return array(md5("{$this->sets['db_pass']}{$this->sets['mostonlinetime']}{$text}"), './register.png');
 }
コード例 #14
0
<?php

/*
 * This work is hereby released into the Public Domain.
 * To view a copy of the public domain dedication,
 * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to
 * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
 *
 */
require_once "../../AntiSpam.class.php";
$object = new AntiSpam("plop");
$object->draw();
コード例 #15
0
ファイル: antispamimage.php プロジェクト: remyyounes/dolibarr
 */

define('NOLOGIN',1);

if (! defined('NOREQUIREUSER'))   define('NOREQUIREUSER',1);
if (! defined('NOREQUIREDB'))     define('NOREQUIREDB',1);
if (! defined('NOREQUIRETRAN'))   define('NOREQUIRETRAN',1);
if (! defined('NOREQUIRESOC'))    define('NOREQUIRESOC',1);
if (! defined('NOTOKENRENEWAL'))  define('NOTOKENRENEWAL',1);

require_once("../main.inc.php");
require_once DOL_DOCUMENT_ROOT.'/includes/artichow/Artichow.cfg.php';
require_once ARTICHOW."/AntiSpam.class.php";

// On cree l'objet anti-spam
$object = new AntiSpam();

// La valeur affichée sur l'image aura 5 lettres
$value=$object->setRand(5);
$object->setSize(128,36);

// Set value in session variable dol_antispam_value
$object->save('dol_antispam_value');

$object->setNoise(0);
$object->setAntiAliasing(false);

$colorbg1=new Color(250,250,250);
$colorbg2=new Color(230,220,210);
$colorfg=new Color(100,100,100);
$colorbr=new Color(220,210,200);
コード例 #16
0
 public function draw()
 {
     $object = new AntiSpam();
     $object->setText($this->text);
     $object->draw();
 }