Since the captcha can only be read using graphical browsers, I thought of this idea to enable users with textish browsers to read the captcha code too.
It's not secure though. Since the captcha code gets printed in a HTML tag (that's how textish browsers can read it), a script can read the code and bypass your captcha protection. I don't recommend applying the patch if you are going to use captcha in anything other than fighting spam comments :).
captcha.module.patch
--- captcha.module.orig 2005-01-19 17:00:08.000000000 +0200
+++ captcha.module 2005-03-05 00:12:03.921875000 +0200
@@ -83,9 +83,10 @@
if (_captcha_istrue("captcha_user_register") && !$newuser->uid && !$user->uid)
switch ($type) {
case t("register"):
- // Add two items to the resigtration form.
+ $string = _captcha_code();
- $output .= form_item("", '<img src="/'.url('captcha/image/'.time()).'" alt="Captcha Image: you will need to recognize the text in it."/>');
+ // Add two items to the resigtration form.
+ $output .= form_item("", '<img src="/'.url('captcha/image/'.time()).'" alt="Captcha: '.$string.'"/>');
$output .= form_textfield(t('Word'), 'captchaword', NULL, 15, 15, 'Please type in the letters/numbers that are shown in the image above.', NULL, TRUE);
return array(array('title' => t('Verify Registration'), 'data'=>$output));
@@ -137,7 +138,8 @@
case 'form':
if (sess_read('captcha_comment_correct')!='ok') {
- $output .= form_item("", '<img src="/'.url('captcha/image/'.time()).'" alt="Captcha Image: you will need to recognize the text in it."/>');
+ $string = _captcha_code();
+ $output .= form_item("", '<img src="/'.url('captcha/image/'.time()).'" alt="Captcha: '.$string.'"/>');
$output .= form_textfield(t('Word'), 'captchaword', NULL, 15, 15, 'Please type in the letters/numbers that are shown in the image above.', NULL, TRUE);
return form_group(t('Verify comment authorship'), $output);
} else return NULL;
@@ -206,7 +208,7 @@
header('Content-type: image/png');
- $string = _captcha_code();
+ $string = sess_read('captcha');
//set up image, the first number is the width and the second is the height
$im = imagecreatetruecolor(120, 20);