Files
forum/captcha/captcha.php

73 lines
3.2 KiB
PHP

<?php
/**********************************************\
| CAPTCHA Mod for Simple Machines Forum |
| (c) 2006 DanSoft Australia |
| http://www.dansoftaustralia.net |
\**********************************************/
//File: captcha.php
// The main CAPTCHA file
//VERSION: 0.1 (Build 1)
//DATE: 11th February 2006
//Based on HN Captcha (c) 2004 Horst Nogajski (http://hn273.users.phpclasses.org/browse/package/1569.html)
if (!defined('SMF'))
die('Hacking attempt...');
global $boardurl, $boarddir, $modSettings;
require_once("hn_captcha.class.x1.php");
// ConfigArray
$CAPTCHA_INIT = array(
//'tempfolder' => "C:/program files/apache group/apache2/htdocs/smf_captcha/captcha/temp/",
//'tempfolderURL' => "http://localhost/smf_captcha/captcha/temp/",
//'TTF_folder' => "C:/program files/apache group/apache2/htdocs/smf_captcha/captcha/",
'tempfolder' => "{$boarddir}/captcha/temp/",
'tempfolderURL' => "{$boardurl}/captcha/temp/",
'TTF_folder' => "{$boarddir}/captcha/",
// mixed (array or string): basename(s) of TrueType-Fontfiles
//'TTF_RANGE' => array('COMIC.TTF','JACOBITE.TTF','LYDIAN.TTF','MREARL.TTF','RUBBERSTAMP.TTF','ZINJARON.TTF'),
'TTF_RANGE' => array('arial-base.ttf', 'SFWill.ttf'),
'chars' => $modSettings['captchaChars'], // integer: number of chars to use for ID
'minsize' => $modSettings['captchaMinSize'], // integer: minimal size of chars
'maxsize' => $modSettings['captchaMaxSize'], // integer: maximal size of chars
'maxrotation' => $modSettings['captchaMaxRotate'], // integer: define the maximal angle for char-rotation, good results are between 0 and 30
'noise' => (isset($modSettings['captchaNoise']) ? TRUE : FALSE), // boolean: TRUE = noisy chars | FALSE = grid
'websafecolors' => (isset($modSettings['captchaWebSafeColours']) ? TRUE : FALSE), // boolean
//'refreshlink' => FALSE, // boolean - not used in SMF CAPTCHA
'lang' => 'en', // Only 'en' supported in SMF CAPTCHA
'maxtry' => 3, // integer: [1-9]
'badguys_url' => $modSettings['captchaBadGuysURL'], // string: URL
'secretstring' => 'The secret string for SMF CAPTCHAs (I changed it!)',
'secretposition' => 21, // integer: [1-32]
//'debug' => TRUE,
'debug' => FALSE,
'counter_filename' => '', // string: absolute filename for textfile which stores current counter-value. Needs read- & write-access!
'prefix' => 'smf_captcha_', // string: prefix for the captcha-images, is needed to identify the files in shared tempfolders
'collect_garbage_after' => 20, // integer: the garbage-collector run once after this number of script-calls
'maxlifetime' => 60 // integer: only imagefiles which are older than this amount of seconds will be deleted
);
$context['captchaObj'] = new hn_captcha_X1($CAPTCHA_INIT);
if ($context['captchaObj']->garbage_collector_error)
die("<b>An ERROR has occured with the CAPTCHA garbage collection!</b><br>Please notify the webmaster.</p>");
function show_captcha() {
global $context;
return $context['captchaObj']->display_form();
}
?>