From: Dan F. <dfr...@cs...> - 2005-10-28 18:14:42
|
Thanks for the Captcha code. I integrated it into our WikiLens user account process (NewUserRegister plugin), although that is not yet live. One change I made that might be interesting to you is that I generate random strings instead of taking words from a dictionary. I can see why you wouldn't want it, but here's the patch to Captcha if you do. Dan % cvs diff -r 1.1 -bu Captcha.php Index: Captcha.php =================================================================== RCS file: .../phpwiki/lib/Captcha.php,v retrieving revision 1.1 retrieving revision 1.2 diff -b -u -r1.1 -r1.2 --- Captcha.php 28 Oct 2005 18:11:28 -0000 1.1 +++ Captcha.php 28 Oct 2005 18:11:51 -0000 1.2 @@ -35,6 +35,18 @@ } } +function get_captcha_random_word () { + // Pick a few random letters or numbers + $word = ""; + // Don't use 1 <=> l or 0 (for o), because they're hard to read + $letters = "abcdefghijkmnopqrstuvwxyz23456789"; + $letter_len = strlen($letters); + for ($i=0; $i<4; $i++) { + $word .= $letters[mt_rand(0, $letter_len-1)]; + } + return $word; +} + // Draw the Spiral function spiral( &$im, $origin_x = 100, $origin_y = 100, $r = 0, $g = 0, $b = 0 ) { $theta = 1; |