Home  >  Article  >  Backend Development  >  PHP verification code tool - Securimage_PHP tutorial

PHP verification code tool - Securimage_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 17:37:121066browse

In my recent project, I came across a new PHP verification code tool - Securimage. It is very simple and convenient to use and supports ajax calls, so I recommend it to everyone here.

What is Securimage?

Securimage is an open source/free phpCAPTCHA script, which can be used to generate complex verification code images to help your website prevent spam. It can be easily embedded into existing forms on your website, providing your website with protection from spam bots. It can run on most webservers that support PHP (GD).

*Click here to view the quick guide
*Securimage Example
*Download the latest version

Features of Securimage:

* Display the verification code with only three lines of code
* Verify the input of the verification code with only six lines of code
* Customize the verification code length
* Customize the character set
* Support TTF
* Use custom GD fonts (if not supported by TTF)
* Easily add custom background images
* Rich text support, including color/angle/transparency options
* Text obfuscated Arched lines through text
* Generate CAPTCHA audio file in wav format
* Customize CAPTCHA verification code list

Here’s a simple example for you:



Securimage Test Form


if (empty($_POST)){?>


Username:



Password:












} else{//form is posted
include("securimage.php");
$img=new Securimage();
$valid=$img->check($_POST[code]);//Check whether the user’s input is correct

if($valid==true) {
echo "
Thanks, you entered the correct code.
";
} else{
echo "< center>Sorry, the code you entered was invalid. Go back to try again.";
}
}

?>



securimage_show.php code:

include securimage.php;//Download the core library code in the package
$img=new securimage();
$img->show();// alternate use: $img->show(/path/to/background.jpg);
?>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/486571.htmlTechArticleIn a recent project, I came across a new PHP verification code tool - Securimage, which is very simple and convenient to use, and supports ajax call, so I recommend it to everyone here. What is...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn