Bay Six Software
Beyond the Basics

Author Message
Brent
Site Admin

Joined: 01 Jul 2005
Posts: 732

Posted: Feb 15th, 2009, 3:57am    Post subject: [BETA DEMO] RB Math CAPTCHA widget

 Code: [Test Captcha] cls print "Please answer a simple math problem to continue." [Repeat Captcha] run "MathCaptcha", #captcha #captcha Difficulty(1,5) #captcha SetFocus() render #captcha button #b, "Submit", [Check Captcha] wait [Check Captcha] print if #captcha IsValid() then     cls     print "Correct." else     cls     print "Incorrect. Try again."     goto [Repeat Captcha] end if end

 Code: ' Math CAPTCHA ' By Brent D. Thorn ' Created 2/2009 ' PUBLIC DOMAIN Global m.answer Global #answer Function Difficulty(low, high)     low = Min(Max(low, 1), 5)     high = Min(Max(high, 1), 5)     n = Abs(high - low) + 1     n = Int(n * Rnd(0) + low)     Select Case n     Case 1 ' a + b         a = Int(5 * Rnd(0) + 1)         b = Int(5 * Rnd(0))         m.answer = a + b         Print a;" + ";b;" = ";     Case 2 ' a + b + c         a = Int(10 * Rnd(0))         b = Int(10 * Rnd(0))         c = Int(10 * Rnd(0))         m.answer = a + b + c         Print a;" + ";b;" + ";c;" = ";     Case 3 ' aa + b         a = Int(90 * Rnd(0) + 10)         c = Int(10 * Rnd(0))         m.answer = a + b         Print a;" + ";b;" = ";     Case 4 ' a * b         a = Int(10 * Rnd(0) + 1)         b = Int(10 * Rnd(0) + 1)         m.answer = a * b         HTML a;" × ";b;" = "     Case 4 ' a * b + c         a = Int(10 * Rnd(0))         b = Int(10 * Rnd(0))         c = Int(10 * Rnd(0))         m.answer = a * b + c         HTML a;" × ";b;" + ";c;" = "     Case 5 ' a + b * c         a = Int(10 * Rnd(0))         b = Int(10 * Rnd(0))         c = Int(10 * Rnd(0))         m.answer = a + b * c         HTML a;" + ";b;" × ";c;" = "     End Select     TextBox #answer, "" End Function Function IsValid()     IsValid = (#answer Value() = m.answer) End Function Function SetFocus()     #answer SetFocus() End Function

_________________
Brent
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First
 All times are GMT Page 1 of 1
 Jump to: Select a forumAnnouncements & RulesThe ClubhouseViviFire language-- ViviFire DocumentationSnippet TestingSapientBoardCode OptimizationInternet ProgrammingInclusive DesignVFScriptWMLiberty DLL-- WMLiberty Demos & TutorialsBay6ZipLB for MS-DOS BASIC UsersArea 5+1General DiscussionsViviFire Archive-- VF Dev & Testing ArchiveGeneral Category Archive
 You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot vote in polls in this forumYou cannot attach files in this forumYou can download files in this forum

Lo-Fi Version
Powered by phpBB © 2001, 2005 phpBB Group