Aerosol Posted December 16, 2014 Report Posted December 16, 2014 Doar copiezi si apoi adaugi in public_htmlindex.php<?phpsession_start();if ( isset( $_POST['submit'] ) ){$code = strip_tags( $_POST['code'] );$real_code = $_SESSION['captcha_code'];if ( $code !== $real_code ){echo "Wrong code! Code was {$real_code}";}else{echo "Correct code!";}}else{?><form method="post"><img src="captcha.php" /><br />Enter code: <input type="text" name="code" /> <input type="submit" name="submit" value="Go" /></form><?php}?>captcha.php<?php/* This tutorial will teach you how to create your own Captcha image. */session_start();$chars = "1234567890qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM";$length = ( isset( $_GET['l'] ) && is_numeric( $_GET['l'] ) ) ? (int)$_GET['l'] : 8;$captcha = "";for ( $i = 1; $i <= $length; $i++ ){$captcha .= $chars[ mt_rand( 0, strlen( $chars ) ) ];}$_SESSION['captcha_code'] = $captcha;$width = ( $length * 10 ) - 3;$img = imagecreate( $width, 17 );$bg = imagecolorallocate( $img, 0, 0, 0 ); //black$txt = imagecolorallocate( $img, 255, 255, 255 ); //whiteimagestring( $img, 5, 3, 1, $captcha, $txt );header( "Content-Type: image/PNG" );imagepng( $img );imagedestroy( $img );?> Quote