NYCPHP Meetup

NYPHP.org

[nycphp-talk] Old subject new day - Pear Captcha

y2rob at aol.com y2rob at aol.com
Mon Jun 16 10:46:35 EDT 2008


 hello rolan,
thanks very much :)

~rob


 


 

-----Original Message-----
From: Rolan Yang <rolan at omnistep.com>
To: NYPHP Talk <talk at lists.nyphp.org>
Sent: Sat, 14 Jun 2008 8:37 am
Subject: Re: [nycphp-talk] Old subject new day - Pear Captcha









y2rob at aol.com wrote:?

> hello rolan,?

> so did you make any code change or just had freetype2 installed??

>?

> ~rob?

>?

> ps - thanks for replying to my post :)?

>?

Unfortunately, I was in a rush to get it done and didn't take notes. I 
do remember now that the true type fonts were not installed on the 
machine either so I copied one over from a windows machine. Here's a 
list of pear stuff installed:?
?

Installed packages, channel pear.php.net:?

=========================================?

Package        Version   State?

Archive_Tar    1.3.1     stable?

Console_Getopt 1.2       stable?

Image_Text     0.6.0beta beta?

PEAR           1.4.9     stable?

Text_CAPTCHA   0.3.1     alpha?

Text_Figlet    1.0.0     stable?

Text_Password  1.1.0     stable?

XML_RPC        1.4.8     stable?
?

Here's  a snippet of code that works (for me):?
?

<?php?
?

require_once 'Text/CAPTCHA.php';?

session_start();?
?

$captcha = Text_CAPTCHA::factory('Image');?

$options = array('font_size'=>'20',?

?      'font_path'=>'/home/webdir/',?

?      'font_file'=>'VERDANA.TTF');?

$captcha->init(150, 60,NULL,$options);?

$image = $captcha->getCAPTCHAAsJPEG();?

file_put_contents('captcha.jpg', $image);?

$_SESSION['captcha_phrase'] = $captcha->getPhrase();?
?

?>?
?

The captcha has succeeded in stopping any futher spam from hitting my 
clients comment board. I've read, however, that something as simple as a 
fixed image and a request to retype the displayed word is sufficient 
(http://www.codinghorror.com/blog/archives/000712.html)?
?

~Rolan?

_______________________________________________?

New York PHP Community Talk Mailing List?

http://lists.nyphp.org/mailman/listinfo/talk?
?

NYPHPCon 2006 Presentations Online?

http://www.nyphpcon.com?
?

Show Your Participation in New York PHP?

http://www.nyphp.org/show_participation.php?



 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20080616/8874533d/attachment.html>


More information about the talk mailing list