Monday, December 3, 2012

How to cretae captcha in php code?

The following piece of PHP code simply create captcha.

 <?php
$chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
$res = "";
for ($i = 0; $i < 7; $i++)
{
       $res .= $chars[mt_rand(0, strlen($chars)-1)];
}
echo  $res;
?>


Try this code and taste the PHP.

No comments:

Post a Comment