Home Forum NetTalk Wiki Download/Upload Links Search Fat Chat
Links

Clarion

Clarion Desktop
Capesoft

Java Script

Java Calendar

NetTalk WebServers

POSitive Connect

Clarion Sites

Pimp my Clarion

RSS Feeds

Add to MyYahoo!
Subscribe in NewsGator Online
Add to Newsburst
Add to Google
Add to My AOL
Add to Pluck
Subscribe in FeedLounge
Add to Windows Live
Add to NetVibes
Subscribe in Rojo
Subscribe in Bloglines
Add to MyMSN
Add to Plusmo for your cellphone
Add to PageFlakes
Add to Technorati
Add to BlinkBits

Site Stats

Visits today: 108
Visits yesterday: 147
Visits month: 800
Visits total: 122026
Max.monthly visits: 6414
  occurred: 2010-8
Pages this month: 3819
Pages total: 682655
Data since: 2007-06-23
NetTalk Central
September 05, 2010, 05:47:42 pm *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Welcome to the NetTalk Central Forums!
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: CAPTCHA Example  (Read 202 times)
DonRidley
Jr. Member
**
Posts: 60


View Profile Email
« on: June 24, 2010, 08:41:48 am »

Special thanks to Bill Shields.  Without him I could not have put this together.

I have attached a zip file containing a web app that has a CAPTCHA.

The app was compiled using Clarion 7.2 7248.   

Solution requires NetTalk and WinEvent

The login name is: demo.  The password is: demo

You will have to setup an account with reCaptcha.  They use an IP address to issue a public key and a private key.  You will need these keys in your code.

For testing purposes, I used the IP address to my home's cable modem.

There's a text file named YourJavascriptCode.  There's some info for you in there.

If you have any questions, please ask them here.

Don
« Last Edit: June 24, 2010, 08:49:03 am by DonRidley » Logged

Clarion 7.2 7283
Windows 7 64bit
DonRidley
Jr. Member
**
Posts: 60


View Profile Email
« Reply #1 on: June 24, 2010, 08:51:40 am »

Here's a screenshot of it in action....

Logged

Clarion 7.2 7283
Windows 7 64bit
Rene Simons
Full Member
***
Posts: 145



View Profile WWW
« Reply #2 on: July 22, 2010, 01:53:16 pm »

Hi Don,

I am very interested in your captcha example.
I am on 6.3 though so it is hard for me (and others) to check it out.
Is there any way for me to get hold of a 6.3 version?

Rene Simons
Logged
DonRidley
Jr. Member
**
Posts: 60


View Profile Email
« Reply #3 on: July 23, 2010, 06:43:07 am »

I would love to but I don't own a copy of C6.x .  Here's a brief overview:

Create an WebForm procedure.

Create local variable: lresponse

I have the lresponse variable in the "fields" section of the form but it is hidden with no prompt.

Insert code into embeds:

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Validate lresponse

lResponse = PostFormResponse('http://api-verify.recaptcha.net/verify','privatekey=6LdXErsSAAAAAKEj4LSWqHjjheCDqwWiUkPEGr7o &remoteip='&p_web.RequestData.FromIP&'&challenge='&CLIP(p_web.GetValue('recaptcha_challenge_field'))&'&=&response='&p_web.GetValue('recaptcha_response_field'))

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Validate lresponse (same embed but used twice..see attached screenshot)

IF INSTRING('true',clip(lresponse),1,1)
    !loc:invalid = 'lresponse'
    !loc:alert = 'The captcha words are incorrect!'
ELSIF INSTRING('false',clip(lresponse),1,1)
    loc:invalid = 'lresponse'
    loc:alert = 'The captcha words are incorrect!'
END

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Create a standard Window procedure

Create local variable: MyText String (1024)

Insert code into embed points:

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

ErrorTrap PROCEDURE(string errorDtr.string fundtionName),VIRTUAL

Before Parent Call

    MyText = ''
    POST(Event:CloseWindow)

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

PageReceived PROCEDURE,VIRTUAL

Before Parent Call

    IF WebClient.PageLen <= 0
      MyText = ''
    ELSIF WebClient.PageLen < Size(MyText)
      MyText = SUB(WebClient.Page,WebClient.HeaderLen,WebClient.PageLen-WebClient.HeaderLen+1)
    ELSE
      MyText = WebClient.Page [WebClient.HeaderLen : SIZE(MyText)-WebClient.HeaderLen+1]
    .
    POST(EVENT:CloseWindow)

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Window Events - Open Window

        WebClient.SetAllHeadersDefault()
        WebClient.CanUseProxy              = 1
        WebClient.HeaderOnly               = 0
        WebClient.AsyncOpenUse             = 1
        WebClient.AsyncOpenTimeOut         = 1200        !12 seconds
        WebClient.InActiveTimeout          = 2000        !20 seconds
        WebClient.ContentType              = 'application/x-www-form-urlencoded'
        WebClient.AcceptEncoding           = ''
        WebClient.ProxyConnectionKeepAlive = 0
        WebClient.ConnectionKeepAlive      = 0
     
        WebClient.ContentLength = LEN(CLIP(lPost))
     
        WebClient.Post(CLIP(lURL),CLIP(lPost))
Logged

Clarion 7.2 7283
Windows 7 64bit
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC
Joomla Bridge by JoomlaHacks.com
Valid XHTML 1.0! Valid CSS!

Login Form

Welcome Guest.






Lost Password?
No account yet? Register

ClarionMag News

mod_dbrss2 AJAX RSS Reader poweredbysimplepie
home contact search contact search