php captcha code

Posted by midhun pottmmal On Monday, 31 December 2012 0 comments
          Using some of the features available in PHP for creating an image. This is very simple and basic 




tutorial and have I used custom fonts for generating captcha image. And we know that captcha code used to avoid spam/abuse or auto-submission
.





Script

<?php
//ader("Content-type: image/jpeg");
$ranStr = md5(microtime());
$ranStr = substr($ranStr, 0, 6);
$_SESSION['cap_code'] = $ranStr;
$newImage = imagecreatefromjpeg("background.jpg");
$txtColor = imagecolorallocate($newImage, 0, 0, 0);
imagestring($newImage, 5, 5, 5, $ranStr, $txtColor);
//
imagejpeg($newImage);
?>

Output Image


0 comments:

Post a Comment

Fashion