How to generate Captcha Code through PHP ?

Description:- In this example I generate the captcha code on the address plate like the following one. The blank image(without captcha) is under the code for you guys, you can download it and use it like me in your example.

blogimage

<!DOCTYPE html>
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 <title>Captcha code</title>
 <style>
 *{padding:0px; margin:0px;}
 .captcha{font-family: Arial, Helvetica, sans-serif;  background:url(capimage.jpg) no-repeat; width:300px; height:150px; line-height:60px; text-align:center;}
 p{font-size:40px; color:rgba(36,32,31,.7); position:absolute; top:50px; left:80px;}
 </style>
 </head>
<body>
<div class="captcha">
 <p>
 <?php
 $a=md5(microtime()*mktime());
 echo substr($a,0,5);
 ?>
 </p>
 </div>
</body>
 </html>

capimage

 

3 thoughts on “How to generate Captcha Code through PHP ?

Leave a comment