/ Published in: PHP
In img tag set src=\"captcha.php\"
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php function create_captcha($char_count = 6) { $possible = '23456789bcdfghjkmnpqrstvwxyz'; $security_code = ''; $i = 0; while ($i < $char_count) { $i++; } //Set the session to store the security code $_SESSION["captcha_code"] = $security_code; $width = 100; $height = 25; //Create the image resource //We are making three colors, white, black and gray //Make the background black //Add randomly generated string in white to the image //Throw in some lines to make it a little bit harder for any bots to break //Output the newly created image in jpeg format //Free up resources } create_captcha(); ?>