Witam mam nie mały problem.
Mam 2 pliczki do captcha które normalnie( bez smarty) działają prawidłowo:
mianowicie
index.php<?
if($_POST['captcha'] != $_SESSION['captcha']){
echo '<font style="color:#c03400;">Niepoprawnie przepisałeś kod z obrazka</font><br>';
}else{
}
?>
<html>
<body>
<form action="index.php?action=add" method="post">
<table>
<tbody>
<tr>
<td valign="top"><small>Login</small><br></td>
<td><input name="user" style="width: 200px; height: 20px;" type="text" /><br></td>
</tr>
<tr>
<td valign="top"><small>Tekst</small><br></td>
<td><textarea name="text" style="width: 300px; height: 100px;"></textarea><br></td>
</tr>
<tr>
<td></td>
<td><img src="captcha.php" alt="" style="vertical-align: middle" /> <input name="captcha" style="width: 100px; height: 20px; vertical-align: middle;" type="text" /><br /><br /></td>
</tr>
<tr>
<td></td>
<td><input name="submit" value="Dodaj" type="submit" /></td>
</tr>
</tbody>
</table>
</form>
</body>
</html>
captcha.php<?
$pool = '0123456789abcdefghijklmnopqrstuvwxyz';
$img_width = 120;
$img_height = 30;
$str = '';
for ($i = 0; $i < 7; $i++){
}
$string = $str;
$_SESSION['captcha'] = $string;
$im = imagecreate($img_width, $img_height);
$bg_color = imagecolorallocate($im,163,163,163);
$font_color = imagecolorallocate($im,252,252,252);
$grid_color = imagecolorallocate($im,31,0,0);
$border_color = imagecolorallocate ($im, 174, 174, 174);
imagefill($im,1,1,$bg_color);
for($i=0; $i<1600; $i++){
$rand1 = rand(0
,$img_width); $rand2 = rand(0
,$img_height); imageline($im, $rand1, $rand2, $rand1, $rand2, $grid_color);
}
$x = rand(5
, $img_width/(7
/2
));
imagerectangle($im, 0, 0, $img_width-1, $img_height-1, $border_color);
for($a=0; $a < 7; $a++){
imagestring
($im, 5
, $x, rand(6
, $img_height/5
), substr($string, $a, 1
), $font_color); $x += (5*2); #odstęp
}
header("Content-type: image/gif"); imagegif($im);
imagedestroy($im);
?>
Sęk w tym że po przerzuceniu tego do smarty nie pokazuje się zdjęcie nie wiem dla czego :/
Ktoś ma jakieś pomysły?