chizijs Posted March 13, 2010 Report Share Posted March 13, 2010 (edited) <?php session_start(); error_reporting(E_ALL); ?> <form action="" method="post"> E-pasts: <input name='email' type='text'><br/> <?php $r1 = rand(0,9); $string = $r1*10+rand(3,5)*3; $_SESSION['captcha'] = $string; $font_size = 5; $width=imagefontwidth($font_size)*strlen($string); $height=imagefontheight($font_size)*2; $img = imagecreate($width,$height); $bg = imagecolorallocate($img,255,255,255); $black = imagecolorallocate($img,0,0,0); $len=strlen($string); for($i=0;$i<$len;$i++) { $xpos=$i*imagefontwidth($font_size); $ypos=rand(0,imagefontheight($font_size)); imagechar($img,$font_size,$xpos,$ypos,$string,$black); $string = substr($string,1); header("Content-Type: image/gif"); imagegif($img); imagedestroy($img); } ?> <input name='db' type='text'><br/> <input name='submit' type='submit' value='Nosūtīt'> </form> Bet errori parādās Warning: Cannot modify header information - headers already sent by (output started at C:\webserv\xampp\htdocs\lockerz.php:7) in C:\webserv\xampp\htdocs\lockerz.php on line 37 GIF87a$€ÿÿÿ,$3„©Ëí£œ´Ú‹³Þ¼û†âH–æ¤Á˜-øºëu÷ª¢~‡ý6“ùf?Ž*xJ*?; Warning: imagechar(): 2 is not a valid Image resource in C:\webserv\xampp\htdocs\lockerz.php on line 35 Warning: Cannot modify header information - headers already sent by (output started at C:\webserv\xampp\htdocs\lockerz.php:7) in C:\webserv\xampp\htdocs\lockerz.php on line 37 Warning: imagegif(): 2 is not a valid Image resource in C:\webserv\xampp\htdocs\lockerz.php on line 38 Warning: imagedestroy(): 2 is not a valid Image resource in C:\webserv\xampp\htdocs\lockerz.php on line 39 Warning: imagechar(): 2 is not a valid Image resource in C:\webserv\xampp\htdocs\lockerz.php on line 35 Warning: Cannot modify header information - headers already sent by (output started at C:\webserv\xampp\htdocs\lockerz.php:7) in C:\webserv\xampp\htdocs\lockerz.php on line 37 Warning: imagegif(): 2 is not a valid Image resource in C:\webserv\xampp\htdocs\lockerz.php on line 38 Warning: imagedestroy(): 2 is not a valid Image resource in C:\webserv\xampp\htdocs\lockerz.php on line 39 Warning: imagechar(): 2 is not a valid Image resource in C:\webserv\xampp\htdocs\lockerz.php on line 35 Warning: Cannot modify header information - headers already sent by (output started at C:\webserv\xampp\htdocs\lockerz.php:7) in C:\webserv\xampp\htdocs\lockerz.php on line 37 Warning: imagegif(): 2 is not a valid Image resource in C:\webserv\xampp\htdocs\lockerz.php on line 38 Warning: imagedestroy(): 2 is not a valid Image resource in C:\webserv\xampp\htdocs\lockerz.php on line 39 Edited March 13, 2010 by chizijs Quote Link to comment Share on other sites More sharing options...
bobsters Posted March 13, 2010 Report Share Posted March 13, 2010 catcha kodu liec cita php faila un pievieno formai ar <img src=captcha.php> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.