public function catpcha() { JpGraph\JpGraph::load(); JpGraph\JpGraph::module('antispam'); $spam = new AntiSpam(); $_SESSION['catpcha'] = $spam->Rand(6); $spam->Stroke(); }
<?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'); } ?>
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); }
<?php include "../funciones/inc/jpgraph_antispam-digits.php"; session_start(); $spam = new AntiSpam(); $chars = $spam->Rand(6); $_SESSION['tmptxt'] = $chars; $spam->Stroke();
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'); }