Jul 04, 2009, 05:15 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
Search via SMF or Google: modx forums all of modxcms.com web
  MODxCMS.com   Forums   Help Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: Better Veriword Captcha Display  (Read 2824 times)
0 Members and 1 Guest are viewing this topic.
devtrench
Member
**
Posts: 53



WWW
« on: May 27, 2007, 11:46 PM »

I really like MODx Smiley I especially like how accessible the core code is when you want to make a modification.  One of the things that really bugged me about MODx is how the Veriword Captcha is displayed - both the look of it and the default words used for the captcha.  I really didn't want my clients having to type in words like Zygote,BitCode,MODx,etc.  I just wanted a 'normal' looking captcha with random characters.   So I modified the veriword script to output what I think looks nice, and it uses a random string of characters.  I just wanted to post the code and images that I redid in case someone else wanted a different look, or wanted to see what I did so they could make the captcha look how they wanted.  It isn't too hard if you know PHP and an image manipulation tool like Photoshop or the Gimp.   

Here is an example of what the script looks like (used with the eForm snippet). 

Enjoy,
James

* better-veriword-captcha-1.0.zip (30.76 KB - downloaded 184 times.)
Logged

rthrash
Foundation
*
Posts: 10,471



WWW
« Reply #1 on: May 28, 2007, 09:00 AM »

Does look much better indeed. Thanks for sharing. Smiley
Logged

MODx is a framework that allows web professionals to turn over sites to end-users for daily maintenance without worrying. Community participation and questions are encouraged, especially when you help us help you, read the wiki, and review snippet parameters – even if you have to look at the source. Searching the forums helps, too.
Ryan Thrash
MODx Co-Founder
Principal @ Collabpad
work productively.
work intelligently.
work together.
sinbad
Committed to MODx
*****
Posts: 675



« Reply #2 on: Dec 03, 2008, 10:32 PM »

anyway to make it non case sensitive?
I tried just lowercase the letters in the file but that makes the letters sometime* unreadable inside the box as they drop down...
Logged
BobRay
Coding Team
*
Posts: 3,173



WWW
« Reply #3 on: Dec 03, 2008, 11:37 PM »

I don't think it's available as a settable option, but you could easily change the code that evaluates the user's input against the $_SESSION variable to do a case-insensitive compare.  These are off the top of my head and untested:

If it's eForm that's doing the check for example, you'd need to change this line (line 178 in eform.inc.php):

Code:
if($fields['vericode']!=$code) {
to
Code:
if (strtolower($fields['vericode']) !=  strtolower($code) ) {

or

Code:
if (strcasecmp($fields['vericode'], $code) == 0) {
Which might be a little faster.

WebLoginPE, OTOH, has

Code:
if ($_SESSION['veriword'] !== $formcode)

which could be changed to

Code:
if (strcasecmp($_SESSION['veriword'],formcode) != 0)

The Manager login comparison is in manager/processors/login.processor.php:

Code:
elseif ($_SESSION['veriword'] != $captcha_code) {

would change to

Code:
elseif (strcasecmp($_SESSION['veriword'],$captcha_code) != 0 )  {


Note that if the captcha words have non-English characters (e.g. é), you might need a more complicated comparison function.
« Last Edit: Dec 04, 2008, 12:37 AM by BobRay » Logged

MODx info for newbies: http://bobsguides.com/MODx.html
sinbad
Committed to MODx
*****
Posts: 675



« Reply #4 on: Dec 04, 2008, 12:30 AM »

consider
Code:
if (strcasecmp($fields['vericode'], $code) == 0) {

as tested. it works perfect Smiley

however the manager capacha gives an error in the related file. mind trying again that one?
Logged
BobRay
Coding Team
*
Posts: 3,173



WWW
« Reply #5 on: Dec 04, 2008, 12:37 AM »

. . . however the manager capacha gives an error in the related file. mind trying again that one?

Oops, missing right bracket and right parend. It should be:

Code:
elseif (strcasecmp($_SESSION['veriword'],$captcha_code) != 0) {
(fixed in post above also -- I hope).

Thanks for checking.

Bob
Logged

MODx info for newbies: http://bobsguides.com/MODx.html
mrhaw
Committed to MODx
*****
Posts: 1,084


modx == freedom


WWW
« Reply #6 on: Dec 04, 2008, 12:46 AM »

Thank you BobRay!!  Smiley
Logged

My playground: http://4up2date.info  | Host: (mt) Media Temple (gs) | Server: Apache 2.0 | MySQL 4.1.11 | PHP 5.2.6 | MODx 0.9.6.3 (patchwork)
sinbad
Committed to MODx
*****
Posts: 675



« Reply #7 on: Dec 04, 2008, 12:47 AM »

No, thank YOU for checking. This works well. Guess we have both tested. sorry don't have WLPE.
Thank you very much!
Logged
sinbad
Committed to MODx
*****
Posts: 675



« Reply #8 on: Dec 04, 2008, 12:51 AM »

btw, for the standard modx capacha you can simply type your words in lower case. I use this modified capacha from devtrench and don't want to lose users due to frustration so bob's solution is perfect...
Logged
dev_cw
Testers
*
Posts: 4,018



WWW
« Reply #9 on: Dec 04, 2008, 05:16 AM »

Nice tip, bookmarked  Grin

BobRay is becoming quite an encyclopedia of modx code (old and new), I am impressed that he knew all those code bits off the top of his head (I would have been opening files and searching for hours). Looks like another team member who 'eats php for breakfast'  Grin Grin Grin
Logged

Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

Something is happening here, but you don't know what it is.
Do you, Mr. Jones?  -  [bob dylan]
BobRay
Coding Team
*
Posts: 3,173



WWW
« Reply #10 on: Dec 04, 2008, 05:37 PM »

Thanks for the kind words. I wish I could make that claim.

I use NuSphere's PhpED as my primary code editor. It has a whole modx install as one project, and Revo as another. It will do a search of the entire MODx codebase in about 5-10 seconds (a little longer for a regex search). When the search is done, it shows each found line in a list in the Search Results pane and, if you click on one, it loads the file for editing and puts the cursor on that line in less than a second.

As a bonus, in the Pro version, I get code highlighting, code folding, multi-file regex search and replace, a db browser/editor, a code explorer, ftp, a zillion keyboard shortcuts, a built-in php debugger, code autoformatting, and a NuSoap Client. If I right-click on a function call, it will offer to take me to the function declaration -- even if it's in a different file. If I right-click on an include file name, it will offer to open the include file. If I start typing a variable name, it will show me a list of variables in the current file to select from.

I couldn't live without it. Someday I'll do a review of it for Bob's Guides.

I should mention that many, if not all, of these capabilities are available in PhpEclipse for free. I happen to like the PhpED user interface better (and it's a one-step install/upgrade) but many people swear by the Eclipse platform.
Logged

MODx info for newbies: http://bobsguides.com/MODx.html
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP

Copyright © 2005-2008 MODxCMS, All rights reserved. Contact Us
Styles by ziworks.com

Powered by SMF | SMF © 2006-2008, Simple Machines LLC

Valid XHTML 1.0! Valid CSS!