Witam, mam problem z zabezpieczeniem captcha. Nie wyświetla mi obrazka, a wgrałem go na ftp i podałem poprawną ścieżkę. Możliwe, że narobiłem kilka błędów, tak więc podam Wam dwa pliki i chciałbym prosić o pomoc w naprawie.
image.php - generuje obrazek captcha
<?
mysql_connect("localhost", "USER", "HASLO") or
die ("Can not connect to the datebase");
$result_captcha = mysql_query("SELECT * FROM captcha WHERE hash = '$_GET[hash]' AND code = '$_GET[code]'") or
die (mysql_error());
$imgn = 'red.png';
$image = imagecreatefrompng($imgn);
$red = imagecolorallocate($image, 70, 0, 0);
$black = imagecolorallocate($image, 0, 0, 0);
imagettftext($image, 45, 15, 15, 110, $red, 'harrington.ttf', $get_captcha['code']);
imagettftext($image, 10, 0, 140, 115, $black, 'arial.ttf', 'xxxl');
header('content-type: image/png');
imagepng($image);
imagedestroy($image);
?>
formularz.php - główny plik wyświetlający formularz + captcha
<?
mysql_connect("localhost", "root", "test123") or
die ("Can not connect to the datebase");
?>
<form action="add.php" method="post">
<img width="256" height="120" src="http://southcraft.pl/image.php?hash=<?=$get_captcha['hash'] ?>">
<input type = "text" name="code">
<input type="hidden" name="hash" value="<?=$get_captcha['hash'] ?>"><br />
<input type="submit" class="input_submit" name="submit" value="Wyślij"/>
</form>
Proszę o wytypowanie błędów i o poprawę kodu. Z góry dziękuje za pomoc.