comparing image code with user code

Discussion in 'PHP' started by hulkrana, May 16, 2007.

  1. #1
    helo frds,
    i m working on registration form.I have to match the image code with user code entered by the user.
    please tel me how to compare.I am sending the file through which i have generated the code.

    thanks
     

    Attached Files:

    hulkrana, May 16, 2007 IP
  2. Subikar

    Subikar Active Member

    Messages:
    241
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    60
    #2
    Check this condition : $_POST['Code'] == $_POST['user_code']

    This will work for you.
     
    Subikar, May 16, 2007 IP
  3. rafiqasad

    rafiqasad Member

    Messages:
    30
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    43
    #3
    make random images. Gave them as the text on the image. For example if the image display 12345 then save that image as 12345. now select a random image . Compare the image name with the user entered text. Hope that this will help you
     
    rafiqasad, May 16, 2007 IP
  4. TwistMyArm

    TwistMyArm Peon

    Messages:
    931
    Likes Received:
    44
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Hmm... not as simple as that as it won't take long before the spam bots just look at the image name!

    I've never done anything like that, but as far as I can work out, you can't have anything client side that is related to the value: even a hash in a cookie can be manipulated. If it were me, I'd set a session variable, send the image and then compare the user input against the session variable.
     
    TwistMyArm, May 16, 2007 IP
  5. gfreeman

    gfreeman Peon

    Messages:
    40
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Store the image name in table with the correct code against it?
    E.g.

    Image shown = 12345
    Image filename = Xj7Rw
    Lookup table entry for Xj7Rw --> 12345
     
    gfreeman, May 16, 2007 IP
  6. gibex

    gibex Active Member

    Messages:
    1,060
    Likes Received:
    21
    Best Answers:
    0
    Trophy Points:
    95
    #6
    1. save image text in session as $_SESSION
    
    2. display created image
    3. compare user_code with $_SESSION[code]
    
    :)
    Code (markup):
     
    gibex, May 16, 2007 IP
  7. zzzttt

    zzzttt Peon

    Messages:
    36
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    use freecap!
    puremango.co.uk/cm_php_captcha_script_113.php
     
    zzzttt, May 16, 2007 IP