Google Like CAPTCHA with PHP.
Wall Script
Follow Me:
Tuesday, July 06, 2010

Google Like CAPTCHA with PHP.

Are you looking for Google style CAPTCHA (Human verification code) script for PHP projects, Please take a look at this post. I want to explain how to implement cool-php-captcha script for forms. Use it and add security to your web projects.

Download Script     Live Demo

Contains HTML code image source captcha.php. File available in download script.
<form method="post"  action="reg.php">
<input type="text" name="name" /><br/>
<textarea name="message"></textarea><br/>
<img src="captcha.php" id="captcha" /><br/>
<a href="#" onclick="
id="change-image">Not readable? Change text.</a><br/><br/>
<b>Human Test</b><br/>
<input type="text" name="captcha" id="captcha-form" /><br/&gt;
<input type="submit" />

Contains PHP code
if (!empty($_REQUEST['captcha']))

if (empty($_SESSION['captcha']) || trim(strtolower($_REQUEST['captcha'])) != $_SESSION['captcha'])
$note= 'Please enter correct text code';


// Insert SQL Statement
$note= 'Values Inserted Successfully';


Source code taken from : Cool-php-captcha
Was this article helpful?
Thanks! Your feedback helps us to improve


  1. So easy and so simple.
    "code is poetry"
    Thanks a lot for share

  2. how far its security vise strong comparing with Recaptcha?

  3. Hi Sri,

    very nice post :)

    you are so active writter :D

  4. I love it! Thank you! Keep them comming!
    Can you make an example Youtube style Thumbs Up/Like script with ajax?

  5. @Marius Patrascu

    Thank you. Sure..

  6. If the CAPTCHA is submitted incorrectly the form text boxes should still keep their POST values.

  7. Hello,
    I am unable to downlaod from always use a mirror like Mediafire too. Its free and too good


  8. very coool scripts thanks for share you ease my life :)

  9. Thanks for easing my coding life, thanks for sharing, cools script!

  10. Can U please write in APC (Alt. php cache )

  11. I got an small problem, my image does not refresh when I click "Not readable? Change text." it just follows the # link... can you have an small look here

  12. awesome tutorial, srinivas. Thanks for sharing

  13. Why does the browser is not displaying an image. In Safari for example it displays a "?" where the image should be. I can't figure out what I'm doing wrong...

  14. Excellent code again mate, have added you to our site:

    Thumbs up :)

  15. thank .... It's nice!

  16. awesome job, keep it up :D

  17. Hi srinivas i want a captcha for HTML there any solution for this...through ajax

  18. very nice and usable! Thank you!
    Can you make and save Ip address and word and time captcha create in Database?

  19. Hey, nice script.

    I'm having some issues with it. It's working awesomely on my laptop with xampp, but when I am uploading the site to my fatcow server, the $_SESSION['captcha'] variable is turning out empty.

    Any pointers what needs to be tightened?

    Thanks again for making such an awesome tool!

  20. It works fine in my local system...captcha image is not displaying on live server.......

  21. Check for directory permissions and also check for gd2 extension.

  22. Hello everyone,

    must say this lib is amazing, it creates really nice images,thank you author!

    but I also have two questions :)
    1) I somehow can't find the option of 'line through text'

    2) I am really missing the transparent option :(
    I was trying to implement it for few days here:

    It's 'probably' almost ready, but I can't figure out how to remove the red 'border' around the text :( It appears somewhere after 'WriteText' function, but I really can't figure out WHY....

    Basically it's original captcha class, just search for 'if($this->transparent)' to see what is changed to enable transparency...

    Example of transparent bg here: (green color comes from the background-color of html page)

    Thanks and waiting for a reply

  23. That's code is good, but I have an essential questions:
    if a hacker knew that I got my code from this site, how is it possible for him/she to hack the words, especially that these words are coming from a fixed list!

  24. Anyway that when the CAPTCHA form is blank that it also says "Please enter a correct value"? That would be helpful instead of it just looking like it sent the form through.

  25. In case anyone still need the transparency, it's posted here:

  26. its good captcha.
    but some problem with this its possible when i submit page and form value is deleted if captcha code is invalid.
    i want when use type invalid code then form value is not to be reset on only captcha value will be reset.
    so if u get it then reply me.....

  27. i m not able to get the image in form ,i m using mozila firefox .what can be the problem .please reply me as soon as possible

  28. Why do you name it Google Captcha?

  29. thanks for sharing

  30. Ran across this script and it works just fine. I am having a problem, however, in getting it to work in an existing $_SESSION-enabled environment. That is, using a slightly more secure technique I establish a "custom" session name and then include code for all routines to join this session. Problem is, I cannot seem to make captcha.php play nice and use the already existing session. Changing the $captcha->session_var to equal my special session name does not work. Any help would be surely appreciated. Thanks.

  31. Nice work boss. can u make an example facebook timeline style cover photo with drag system?

  32. Nice work boss. can u make an example facebook timeline style cover photo with drag system?

  33. thanks for sharing :D


Make in India