Тема: Правильная каптча
Каптча на регистрацию.
register.php
находим
define('PUN_ROOT', './');
require PUN_ROOT.'include/common.php';заменяем на
$captcha_questions = array(
'5 + 3 = ?' => 8,
'4 - 3 = ?' => 1,
'2 + 7 = ?' => 9,
'8 - 6 = ?' => 2,
'4 + 5 = ?' => 9,
'9 - 4 = ?' => 5
);
$captcha_index = rand(0,count($captcha_questions)-1);
define('PUN_ROOT', './');
require PUN_ROOT.'include/common.php';находим
else if (isset($_POST['form_sent']))
{заменяем на
else if (isset($_POST['form_sent']))
{
// Check the captcha
$p_question = trim($_POST['captcha_q']);
$p_answer = trim($_POST['captcha']);
$questions_arry = array();
foreach ($captcha_questions as $k => $v)
$questions_arry[md5($k)] = $v;
if (empty($questions_arry[$p_question]) || $questions_arry[$p_question] != $p_answer)
message($lang_register['Captcha warn']);находим
<p><input type="submit" name="register" value="<?php echo $lang_register['Register'] ?>" /></p>заменяем на
<div class="inform">
<fieldset>
<legend><?php echo $lang_register['Captcha'] ?></legend>
<div class="infldset">
<?php
$question = array_keys($captcha_questions);
$qencoded = md5($question[$captcha_index]);
?>
<p><?php echo $lang_register['Captcha desc'] ?></p>
<label><strong><?php echo $question[$captcha_index] ?></strong><br />
<input name="captcha" id="captcha" type="text" size="7" maxlength="7" />
<input name="captcha_q" value="<?php echo $qencoded ?>" type="hidden" /><br /></label>
</div>
</fieldset>
</div>
<p><input type="submit" name="register" value="<?php echo $lang_register['Register'] ?>" /></p>lang/english/register.php
добавляем в конец
'Captcha' => 'Protection against automatic registration',
'Captcha desc' => 'To finish registration answer a following question.',
'Captcha warn' => 'The number entered by you is incorrect.',lang/russian/register.php
добавляем в конец
'Captcha' => 'Защита от автоматической регистрации',
'Captcha desc' => 'Для того, чтобы завершить регистрацию ответьте на следующий вопрос.',
'Captcha warn' => 'Введённое вами число неверно.',Пример работы: wpforum.ru/