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

 

Advertisements

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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s