Mathcaptcha.plugin

From FUDforum Wiki
Jump to: navigation, search

Mathcaptcha.plugin is a plugin that presents users with a mathematical captcha instead of FUDforum's default captcha challenge.

Contents

Prerequisites

None, this plugin can be uploaded and activated as-is on any forum (FUDforum 3.0.0 or higher).

Usage

If enables, users will see a mathcaptcha when trying to register or when posing anonymously (if enabled).

Code (FUDforum 3.0.9 or higher)

File mathcaptcha.plugin:

<?php
// Initialize plugin
plugin_add_hook('CAPTCHA', 'plugin_mathcaptcha');

// Implement a simple mathematical CAPTCHA
function plugin_mathcaptcha() {
	$n1 = mt_rand(1,10); 
	$n2 = mt_rand(0,10);
	$answer = $n1 + $n2;

        $text = 'Please sum the two numbers: '. $n1 .' + '. $n2 .'<br />';
	$text .= '<input type="text" name="turing_test" id="turing_test" size="25" required="required" />';
	$text .= '<input type="hidden" name="turing_res" value="'. md5($answer) .'" />';
	return $text;
}

Old code (before FUDforum 3.0.9)

File mathcaptcha.plugin:

<?php
// Initialize plugin
plugin_add_hook('CAPTCHA', 'plugin_mathcaptcha');

// Implement a simple mathematical CAPTCHA
function plugin_mathcaptcha() {
	$n1 = mt_rand(1,10); 
	$n2 = mt_rand(0,10);
	$answer = $n1 + $n2;
	return array('Please sum the two numbers: '.$n1.' + '.$n2, $answer);
}

Also see

Languages
Personal tools
This is a cached copy of the requested page, and may not be up to date.

Sorry! This site is experiencing technical difficulties.
Try waiting a few minutes and reloading.

(Can't contact the database server: Cannot return last error, no db connection)


You can try searching via Google in the meantime.
Note that their indexes of our content may be out of date.