1 of 2
1
Audio CAPTCHA module
Posted: 27 August 2007 04:45 AM   [ Ignore ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1866
Joined  10-22-2006

Moving to here from this thread.

Bobby McGee - 03 June 2007 03:40 AM

I have a significant visual impairment and love EE. But the number of EE-powered sites that use CAPTCHAs to combat comment spam is disconcerting. I cannot read them at all. I would appreciate it if someone could look into getting an audio CAPTCHA bundled with the visual one.

Here’s a first approach to the subject: Audio CAPTCHA.

What the module does is pretty straightforward. There is one single tag that returns the URL to a dynamically created .wav-file.

You can use this tag as if it was the URL to an ordinary .wav-file and include it in your templates, probably in the vicinity of the {captcha} variable, in any way youu see fit.
Some basic examples.

 Signature 

utilitEEs - Addons for EE

Profile
 
 
Posted: 27 August 2007 12:09 PM   [ Ignore ]   [ # 1 ]  
Administrator
Avatar
RankRankRankRankRankRankRank
Total Posts:  26056
Joined  05-14-2004

Oh my goodness, I need tech support!

Ok, I entered my path as this:

/www/username/public_html

I also tried:

/www/username/public_html/audio/
/www/username/public_html/audio/lisajill/

and whenever I click I just get Invalid URI, see this entry

I already had an “audio” folder for my poetry recordings, so I put a “lisajill” folder in there and used this tag:

{if captcha}
<div class="row">
<
span class="label">Please enter the word you see in the image:</span>

<
span class="formw">{captcha}
<input type="text" name="captcha" value="{captcha_word}" maxlength="20" />
</
span>
<
a href=”{exp:audio_captcha:wavlink}”>Read CAPTCHA</a
</
div>
{/if} 

It may be because I have no 1.wav etc in the audio folder, must we use “audio” as the folder?  I’m already using that and all.  I did try renaming the top folder to lisajill-audio with all the .wavs in the top level, but got the same problems.

 Signature 
Profile
MSG
 
 
Posted: 27 August 2007 03:51 PM   [ Ignore ]   [ # 2 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1866
Joined  10-22-2006

The (audio-)folder containing the sound-files can be named however you like.

If your doc-root was

/www/username/public_html

and the (audio-)folder containing a.wav, b.wav, c.wav, ... was named

mysounds 

you’d enter

/www/username/public_html/mysounds

in the module configuration.


If your captchas don’t contain numbers you don’t need 1.wav etc.

Right now it seems to be looking for wav-files in

/www/username/public_html/lisajill

where it doesn’t find any.

Plus there seems to be some issue beginning around the textarea:

<textarea itsalltext_uid="2h2d2w2u1z2b1g351d231w291y17351t1x2d1b231u291p1p" id="itsalltext_generated_id_comment_1" name="comment" cols="70" rows="10"></textarea;</span
 Signature 

utilitEEs - Addons for EE

Profile
 
 
Posted: 27 August 2007 04:22 PM   [ Ignore ]   [ # 3 ]  
Administrator
Avatar
RankRankRankRankRankRankRank
Total Posts:  26056
Joined  05-14-2004

Ah, Safari 3, how I love and hate thee.

Yea, it’s running out of memory.  Perhaps I made my sound files too large, I thought I made them plain ole 8bit with Audacity.

But also, the URLs are all butchered.  Going to have to downgrade Safari again and see if that helps :(

Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 301989873 bytes) =/

 Signature 
Profile
MSG
 
 
Posted: 27 August 2007 04:25 PM   [ Ignore ]   [ # 4 ]  
Administrator
Avatar
RankRankRankRankRankRankRank
Total Posts:  26056
Joined  05-14-2004

Ok yes, was able to correct the URL issues by editing the template in Firefox.  Nevertheless it’s trying to use 60meg of memory.  Is that because of the size of my audio files or is something else up?

Eh, nevermind. I’m going to just record them in something other than Audacity, I think there’s a confused MIME type issue.  Meh.

Thanks =)

 Signature 
Profile
MSG
 
 
Posted: 27 August 2007 04:52 PM   [ Ignore ]   [ # 5 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1866
Joined  10-22-2006
Lisa Wess - 27 August 2007 08:22 PM

Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 301989873 bytes) =/

Sounds like large soundfiles…

Version 1.1 also supports MP3, by the way.
The only way I could get it to work together with a flash-player like the last example there.

Will be probably be published tomorrow…

 Signature 

utilitEEs - Addons for EE

Profile
 
 
Posted: 27 August 2007 04:54 PM   [ Ignore ]   [ # 6 ]  
Administrator
Avatar
RankRankRankRankRankRankRank
Total Posts:  26056
Joined  05-14-2004

Ah, good to know. I’ll re-record as mp3s, then, and await the new one. Thank you, silenz!

Just as a note, they average 100k on disk, so loading a bunch of them would lead to this.  MP3s will be much better. =)

 Signature 
Profile
MSG
 
 
Posted: 27 August 2007 05:03 PM   [ Ignore ]   [ # 7 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1866
Joined  10-22-2006

Yep, that’s much.
Mono and a low sample-rate should actually be sufficient if you got a good microphone.

Good example: http://cafe.bevocal.com/libraries/audio/female1/en_us/alphabet/
Nice quality and around 10k per file.

You probably don’t gain much compression using mp3 when the samples are only 1-2 seconds long.

 Signature 

utilitEEs - Addons for EE

Profile
 
 
Posted: 27 August 2007 05:15 PM   [ Ignore ]   [ # 8 ]  
Administrator
Avatar
RankRankRankRankRankRankRank
Total Posts:  26056
Joined  05-14-2004

They were on mono and the lowest sample rate, but Audacity was being a pain in the neck.  I’ll try again and get it going =) It’d be nice to use MP3 though because I already have my flash mp3 player set up for this, so I’m going to wait anyway.

 Signature 
Profile
MSG
 
 
Posted: 28 August 2007 05:47 AM   [ Ignore ]   [ # 9 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1866
Joined  10-22-2006

Updated to 1.1.

 Signature 

utilitEEs - Addons for EE

Profile
 
 
Posted: 28 August 2007 11:07 AM   [ Ignore ]   [ # 10 ]  
Administrator
Avatar
RankRankRankRankRankRankRank
Total Posts:  26056
Joined  05-14-2004

Works great, but my flash player hates it. Which one are you using, silenz?  Mine is balking at something, though I’m not sure what, since it works with my entries the way I have it.  The second I substitute the hard URL your module creates, it hates me.  So time for something that’ll work with it wink

 Signature 
Profile
MSG
 
 
Posted: 28 August 2007 11:08 AM   [ Ignore ]   [ # 11 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1866
Joined  10-22-2006
Lisa Wess - 27 August 2007 08:22 PM

Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 301989873 bytes) =/

This still keeps me wondering…

I ran some tests on the memory consumption of the module. Roughly speaking it seems to usenot much more than about 2,300,000 bytes base memory + the combined sizes of the audio files used.

Even if your files are 100k each, which is a lot, a 6-letter CAPTCHA would leave you below 3M memory usage. Why on earth would it want to allocate 300M?

EDIT: Well seems to be resolved wink

 Signature 

utilitEEs - Addons for EE

Profile
 
 
Posted: 28 August 2007 11:22 AM   [ Ignore ]   [ # 12 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1866
Joined  10-22-2006
Lisa Wess - 28 August 2007 03:07 PM

Works great, but my flash player hates it. Which one are you using, silenz?  Mine is balking at something, though I’m not sure what, since it works with my entries the way I have it.  The second I substitute the hard URL your module creates, it hates me.  So time for something that’ll work with it wink

I think I know what you mean. I encountered the same. Most players don’t seem to like the URL. I have no idea why, actually.
Back in times of Flash 5 I’ve written some games in Flash but afterwards never got around to do something in Flash anymore.

I’ve been using XSPF Music Player which can play single files as well as xspf-playlists.

So what I did is create an XML-template in EE to work as playlist. In there I use the {exp:audio_captcha:mp3link}-tag to output the URL.

Template site/playlist:

<?xml version="1.0" encoding="UTF-8" ?>
<playlist version="1" xmlns="http://xspf.org/ns/0/">
<
trackList>    
<
track>
<
location>{exp:xml_encode}{exp:audio_captcha:mp3link}{/exp:xml_encode}</location>
</
track>              
</
trackList>
</
playlist

Then I feed the playlist to the plugin:

<object type="application/x-shockwave-flash" width="40" height="40"
data="http://localhost/musicplayer.swf?playlist_url=http://localhost/index.php/site/playlist/">
<
param name="movie" 
value="http://localhost/musicplayer.swf?playlist_url=http://localhost/index.php/site/playlist/" />
</
object

Which happens to work just fine wink

 Signature 

utilitEEs - Addons for EE

Profile
 
 
Posted: 28 August 2007 11:52 AM   [ Ignore ]   [ # 13 ]  
Administrator
Avatar
RankRankRankRankRankRankRank
Total Posts:  26056
Joined  05-14-2004

Hrm, see, mine can take a playlist, but since it was just a single audio file I figured I’d just feed it the URL.  That’s how I do my “talk to people” entries, but I don’t have anything odd in the URL string in those.

Your code just confused the heck out of me, not in the code manner, but in the, “what about all those other playlists?” manner.  Nrr.  I’ll have to think on this some more. =)

 Signature 
Profile
MSG
 
 
Posted: 28 August 2007 02:32 PM   [ Ignore ]   [ # 14 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1866
Joined  10-22-2006
Lisa Wess - 28 August 2007 03:52 PM

Your code just confused the heck out of me, not in the code manner, but in the, “what about all those other playlists?” manner.  Nrr.  I’ll have to think on this some more. =)

Didn’t meant to confuse anyone wink

Which other playlists?

 Signature 

utilitEEs - Addons for EE

Profile
 
 
Posted: 28 August 2007 03:01 PM   [ Ignore ]   [ # 15 ]  
Administrator
Avatar
RankRankRankRankRankRankRank
Total Posts:  26056
Joined  05-14-2004

I don’t know which other ones, the ones from all the other CAPTCHAs and entries? Seems utterly silly to need an entire playlist simply for one darn mp3 file.  I still can’t figure out why it won’t take this URL.  The others all have ampersands and =, the only difference in this URL is the addition of a question mark. :(

 Signature 
Profile
MSG
 
 
Posted: 28 August 2007 04:38 PM   [ Ignore ]   [ # 16 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1866
Joined  10-22-2006

No, this is just a bogus playlist. It will always contains one title - the URL generated by the module-tag.
There is only one playlist, for all captchas, for all entries, for all users.

The only difference with this approach is just that the module-tag is called when Flash loads the playlist.
Instead of being called in the main template when you would add the URL to the Flash-<object>.

Still confused? Once you grasp the concept, it all makes sense. Just like EE wink

 Signature 

utilitEEs - Addons for EE

Profile
 
 
Posted: 28 August 2007 05:29 PM   [ Ignore ]   [ # 17 ]  
Administrator
Avatar
RankRankRankRankRankRankRank
Total Posts:  26056
Joined  05-14-2004

Yes, now everyone gets to make fun of me for needing technical support. 

Yes, it makes sense. I’ll have to fiddle over the weekend. wink  Thanks, silenz!

 Signature 
Profile
MSG
 
 
Posted: 20 September 2007 06:11 AM   [ Ignore ]   [ # 18 ]  
Summer Student
Total Posts:  18
Joined  06-03-2006

I found a really useful script today, so thought I’d share it!

Soundmanager2: Javascript API which hooks to flash. soundmanager2

To get it working with audio CAPTCHA follow instructions on the developers site then in your contact form add this:

{if captcha}

<p>{captcha}<input type="text" name="captcha" value="" maxlength="20" /></p>

<
a href="#" onclick="soundManager.createSound({id:'mySound1',url:'{exp:audio_captcha:mp3link}'});soundManager.play('mySound1')">audio CAPTCHA</a>

{/if} 

Working example (incidently also using freeform) can be found here: link (contact link)

@Silenz Thanks - good job!

Profile
 
 
   
1 of 2
1