basicCAPTCHA

by JaeR

This is a pretty simple CAPTCHA generator that allows you to create your own CAPTCHA for a website. Right now its intended use is limited. There may be expansions in the future that allow it to generate more options using a few simple calls to the run-time.

Now with text generation! This is just a very basic sample of what you can do with a CAPTCHA with something as powerful as Run Basic. The known working fonts are (underscores absolutely necessary!):

  • Arial
  • Arial_Black
  • Comic_Sans
  • Courier
  • Courier_New
  • Helvetica
  • Tahoma
  • Times
  • Webdings (sorta)


'basicCAPTCHA
'Completely Automatic Public Turing test to tell Computers and Humans Apart
'by Jae
 
[main]
'first, we gather the size of the CAPTCHA
input "What will be the width (max 300)"; width
input "What will be the height (max 300)"; height
input "What will be the font"; fnt$
input "What will be the size"; size
input "What will be the word"; captcha$
print
 
'check if there are any errors in the size
if width < 1 then goto [error]
if height < 1 then goto [error]
if width > 300 then goto [outSize]
if height > 300 then goto [outSize]
print "Generating CAPTCHA of " ;width; " wide by " ;height; " high:"
 
print
 
[generate]
graphic #CAPTCHA, width, height
#CAPTCHA size(1) 'pen size one
 
'loop through the width and height, setting a random color
for y = 0 to height - 1
for x = 0 to width - 1
color = int(rnd(1)*2) + 1
if color = 1 then #CAPTCHA color(0,0,0)
if color = 2 then #CAPTCHA color(255,255,255)
#CAPTCHA set(x,y)
next x
next y
 
#CAPTCHA color(255,255,255)
#CAPTCHA place(5,(size + 10))
#CAPTCHA font(fnt$,size,"bold")
#CAPTCHA "\";captcha$
 
render #CAPTCHA
goto [tryAgain]
 
[error]
print "Problem with sizing. Did you use numbers? Did you generate numbers greater than 0?"
goto [tryAgain]
 
[outSize]
print "That's too large! Please keep it within 300x300 for the sake of the server!"
goto [tryAgain]
 
[tryAgain]
input "Try again (y/n)?"; try$
if try$ = "y" then [main]
if try$ = "n" then [End]
print "Say what? Please remember this is case-sensitive!"
goto [tryAgain]
 
[End]
print "Thanks for trying it out!"