Капча с обновлением http://myrusakov.ru/php-captcha-update.html
<?php
// создаем файл captcha.php
session_start(); // Начинаем сессию
$string = "";
for ($i = 0; $i < 5; $i++)
$string .= chr(rand(97, 122)); // Генерация случайной строки
$_SESSION['rand_code'] = $string; // Записываем код в сессию
$dir = "fonts/"; // Путь к папке со шрифтом
$image = imagecreatetruecolor(170, 60); // Создаём изображение
$color = imagecolorallocate($image, 200, 100, 90); // Создаём цвет текста
$white = imagecolorallocate($image, 255, 255, 255); // Создаём цвет фона
imagefilledrectangle($image, 0, 0, 170, 60, $white); // Закрашиваем изображение
imagettftext ($image, 30, 0, 10, 40, $color, $dir."verdana.ttf", $_SESSION['rand_code']); // Рисуем текст на капче
header("Content-type: image/png"); // Отправляем заголовок с типом содержимого
imagepng($image); // Выводим картинку
?>
Вставляем куда надо
<img src="captcha.php" alt="" id="captcha" />
<span style="border-bottom: 1px dashed #f00; color: #f00; cursor: pointer;" onclick="document.getElementById('captcha').src = 'captcha.php?' + Math.random()">Обновить</span>