formulario de contato + captcha

Started by rog, 30 de October , 2006, 03:07:18 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

rog

resolvi colocar um formulario de contato no meu binder e codei um captchazinho

http://rgirardin.mine.nu/binder1.13/index3.php

algums conseilhos sobre o grafismo ?

a funçao captcha

function captcha($string){
$im = @imagecreatetruecolor(60,25)
     or die ("Impossible de crée un flux d'image GD");
$text_color = imagecolorallocate ($im,255,255,255);
imagestring ($im,5,5,5,$string,$text_color);
#
$filename = md5(md5(md5($string))).".png";
imagepng ($im,"./captcha/".$filename);
imagedestroy ($im);
return "./captcha/".$filename;

}

o gerador de numero + html input

create_dir("./captcha");
#
$string = rand(0,99999);
$img = captcha($string);

<img src=\"$img\" width\"60\" height=\"25\">
<input type=\"text\" class=\"input1\" name=\"captcha\" value=\"\" >
<input type=\"hidden\" name=\"img_filename\" value=\"".$img."\">            


o codigo de verificaçao

if(isset($_POST['captcha']) && is_numeric($_POST['captcha']) && $_POST['captcha'] >= 0 && $_POST['captcha'] < 100000)
{
$explode = explode('.',$_POST['img_filename']);
$explode2 = explode('/',$explode[1]);
#
$md5 = md5(md5(md5($_POST['captcha'])));
#
if($md5 == $explode2[2])

rog
realty.sys is corrupt :  reboot the universe (Y/N)