View Full Version : Capcha
chechu
11-17-2006, 12:51 PM
Hey guys,
How can I add CAPTCHA in a regular .php mailform ?
djr33
11-17-2006, 08:50 PM
Uh... that's complex.
You need to use the GD library to dynamically generate an image based on input and then later compare that original input to what the user types. Furthermore, you need to create it with distortion so a computer can't read it.
As I said, complex.
You could alternatively have images you created by hand (say 10 of them might work for a small site) and corresponding 'correct' values for them that would later be matched. Be sure never to output that value, just keep it secure in the php code.
Read this thread (http://dynamicdrive.com/forums/showthread.php?p=58430).
chovy
11-18-2006, 06:13 AM
http://chovy.dyndns.org/php/captcha.php
just did this one in a few hours. although most of that time was looking for a TTS library.
It's probably not worthy of a high-traffic site, as I'm not tweaking the text or background (yet anyway).
BLiZZaRD
11-18-2006, 08:24 AM
Most decent servers already have a GD library installed, and I found a nice little file that will tell you, you can download it below.
Just rename it to gd-test.php, upload to your domain, browse to the page and view the results. If you have it then no need for all the extra worrying :D
chechu
11-18-2006, 09:16 AM
Thanks guys.
What code do I need to add to the mailform ?
chovy
11-18-2006, 11:16 AM
what language is it in?
chechu
11-18-2006, 12:05 PM
html sending to a php
just did this one in a few hours. although most of that time was looking for a TTS library.Festival (http://www.cstr.ed.ac.uk/projects/festival/) will serve your purposes. Run it against a Sable XML file or a Scheme script, not just plain text: this will allow you more control over the factors required for transformation.
It's probably not worthy of a high-traffic site, as I'm not tweaking the text or background (yet anyway).It won't even provide a barrier. There are freely-available CAPTCHA breakers out there that will crack that with a 100% success rate in milliseconds.
chechu
11-19-2006, 04:49 PM
What code do I need to add to the mailform in order to get a capcha ? The form is made in .html submitting to a .php.
chechu
11-21-2006, 08:47 PM
Mike wrote in another thread that this could replace a captcha
$texts = array("el301kfs","s94kf9ds","si340fsk","4iogfd0h","49ffle95","fo40fsl4","903mvlsmf");
$rand = rand(0,count($texts)-1);
header("Content-type: image/png");
$im = @imagecreate(80, 50)
or die("Cannot Initialize new GD image stream");
$background_color = imagecolorallocate($im, 255, 255, 255);
$text_color = imagecolorallocate($im, 255, 0, 0);
imagestring($im, 2, 6, 5, $texts[$rand], $text_color);
imagepng($im);
imagedestroy($im);
But how do I place this ? In a .php ?
chovy
11-21-2006, 08:49 PM
create a file called captcha-image.php
That is a very basic CAPTCHA. It will present no trouble whatsoever to bots, and will stop blind people from accessing your site.
tech_support
11-21-2006, 10:38 PM
How can blind people access a computer anyway? Do they have special keyboards?
chechu
11-22-2006, 09:51 AM
So I save the above code as capcha-image.php. Do I place <?- before it ?
And what code do I add in the form to see this .php file ?
BLiZZaRD
11-22-2006, 10:21 AM
How can blind people access a computer anyway? Do they have special keyboards?
Yes they do. Haven't you ever seen Sneakers?? ROTF
How can blind people access a computer anyway? Do they have special keyboards?Why would they need special keyboards? There's nothing to stop a blind person from typing, or even from learning to type (so long as some form of feedback is given telling them which key they're pressing).
Text-to-speech technologies help a lot.
So I save the above code as capcha-image.php. Do I place <?- before it ?
And what code do I add in the form to see this .php file ?Don't bother. As I said above, the above script might as well not be there, and will cause more problems than it will solve.
chechu
11-23-2006, 10:58 AM
Another solutions, if I wish to place captcha ?
chovy
11-23-2006, 11:35 AM
i think the basic problem there is that it uses only white and black.
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.