The final script is shown below: <?php
session_start();
$stringgen = mt_rand(1000, 9999);
$_SESSION['answer']=$stringgen;
$imagecreate = imagecreate(50, 50);
$background = imagecolorallocate($imagecreate, 0, 0, 255);
$textcolor = imagecolorallocate($imagecreate, 255, 255, 255);
for ($c = 0; $c < 200; $c++){
$x = rand(0,50-1);
$y = rand(0,50-1);
imagesetpixel($imagecreate, $x, $y, $textcolor);
}
$xlocation = rand(1,10);
$ylocation = rand(1,10);
imagestring($imagecreate, 5, $xlocation, $ylocation, $stringgen, $textcolor);
header("Content-type: image/png");
$image= imagepng($imagecreate);
?> Conclusions and Recommendations There are still a lot of ways to increase the difficulty of captcha, such as distorting the text or having the characters appear connected to each other. However, this system can also substantially increase the difficulty humans will experience in solving it, and even humans can commit frequent mistakes when answering this type of challenge. As shown in this tutorial, simply increasing the background noise can make the OCR unable to solve the challenge properly without necessarily adding too much difficulty for humans.
blog comments powered by Disqus |
|
|
|
|
|
|
|