Random image to prevent automatic registration

Discussion in 'Programming' started by senloong, May 7, 2007.

  1. #1
    I am doing a travel blog in coldfusion and I would like to prevent automatic registration.
    Does anyone kindly provide some tutorial of random image with security code to prevent automatic registration?

    Thanks in advance!
     
    senloong, May 7, 2007 IP
  2. IsRoss()

    IsRoss() Peon

    Messages:
    116
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Sure...I use a web service provided by Easycfm.com. In a nut shell, I consume the web service - this gives me a file name and the text equivalent. (This is done from the registration form template). I set the text value of the captcha using a session variable. After the form is posted, I compare the user entry to the session variable to ensure they match.

    EasyCFM.com has good example code:
    <cfscript>
    // Define the values to pass to the object
    theight = "350";
    twidth = "350";
    tfont = "Verdana";
    tfontColor = "Black";
    tfontSize = "12";
    tfontOpacity = 100;
    tbgcolor1 = "white";
    tbgcolor2 = "white";
    tquality = 10;
    tdistortionMethod = 1;
    tXPos = 10;
    tYPos = 10;
    </cfscript>

    <cfinvoke
    webservice="http://www.easycfm.com/webservices/captcha.cfc?wsdl"
    method="generateCaptcha"
    returnvariable="aHashMap">
    <cfinvokeargument name="height" value="#tHeight#"/>
    <cfinvokeargument name="width" value="#tWidth#"/>
    <cfinvokeargument name="font" value="#tFont#"/>
    <cfinvokeargument name="fontColor" value="#tFontColor#"/>
    <cfinvokeargument name="fontSize" value="#tfontSize#"/>
    <cfinvokeargument name="fontOpacity" value="#tfontOpacity#"/>
    <cfinvokeargument name="bgcolor1" value="#tbgcolor1#"/>
    <cfinvokeargument name="bgcolor2" value="#tbgcolor2#"/>
    <cfinvokeargument name="quality" value="#tquality#"/>
    <cfinvokeargument name="distortionMethod" value="#tdistortionMethod#"/>
    <cfinvokeargument name="XPos" value="#tXPos#"/>
    <cfinvokeargument name="YPos" value="#tYPos#"/>
    </cfinvoke>

    <!--- set the session variable --->
    <cfset session.CAPTCHAWORD=#aHashMap.CAPTCHAWORD#>
    <!--- show the image --->
    <img src="#aHashmap.image#">

    In the reg form:
    <input type="text" name="catchaword">

    In the action template:
    <cfif form.captchaword NEQ session.catpchaword>
    (do something)
    </cfif>
     
    IsRoss(), May 8, 2007 IP
  3. tical

    tical Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I'd just like to point out that CFMX 8 (in beta now, to be released in August or September) has this functionality built-in.
     
    tical, May 10, 2007 IP
  4. IsRoss()

    IsRoss() Peon

    Messages:
    116
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Yup, it's a function of the new CFIMAGE tag!
     
    IsRoss(), May 11, 2007 IP
  5. senloong

    senloong Peon

    Messages:
    102
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #5
    thank you very much. Seems like CFMX 8 has enchanced many features!
     
    senloong, May 11, 2007 IP
  6. TopHosting.us

    TopHosting.us Peon

    Messages:
    66
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Even thought it's in beta, can anyone download it? If so, anyone have a link? Would greatly appreciate it. Thanks!
     
    TopHosting.us, May 13, 2007 IP
  7. IsRoss()

    IsRoss() Peon

    Messages:
    116
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #7
    It is a closed beta program for now; not sure when or if it will become public.
     
    IsRoss(), May 14, 2007 IP