Results 1 to 10 of 10

Thread: Registering Form Validation

  1. #1
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default Registering Form Validation

    I made a register/user login page (http://mburt.mb.funpic.org/reg_info.php) but I want to be able to validate my register page... ya' know, those images where you have to type in the letter/number combination in it. There's a name for it, but I have temporarily forgotten it
    Is there a PHP function for this?
    - Mike

  2. #2
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    You're referring to a CAPTCHA, yes? There's no single function for these that I know of: you'd use the GD library to generate the image dynamically. There probably are existing examples around, though.

    Mike

  3. #3
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    Yes, that's the name. See the problem was that I forgot the name, so couldn't google it, and I've not much knowledge for it anyway. Thanks (again lol)
    - Mike

  4. #4
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    I didn't use captcha; I used a different method.
    Something along these lines:
    Code:
    $texts = array("el301kfs","s94kf9ds","si340fsk","4iogfd0h","49ffle95","fo40fsl4","903mvlsmf");
    $rand = rand(0,count($texts)-1);
    header("Content-type: image/png");
    $im = @imagecreate(80, 50)
       or die("Cannot Initialize new GD image stream");
    $background_color = imagecolorallocate($im, 255, 255, 255);
    $text_color = imagecolorallocate($im, 255, 0, 0);
    imagestring($im, 2, 6, 5, $texts[$rand], $text_color);
    imagepng($im);
    imagedestroy($im);
    - Mike

  5. #5
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    CAPTCHA: Completely Automated Public Turing test to tell Computers and Humans Apart. This qualifies as a CAPTCHA, although it's bypassable by even the most rudimentary of bots and so not really worth the effort.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  6. #6
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    So how exactly could I make it more secure?
    - Mike

  7. #7
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Look at Yahoo for some examples. There was a particularly good site that had a list of principles for a good CAPTCHA, but I can't find it now. They are, as far as I can remember:
    • Use a random string, not a dictionary word
    • Use a background that is technically indistinguishable from the text and requires human logic to figure out
    • Don't use well-formed or regularly-distorted letters; skew some parts, stretch others, fade from one colour to another...
    • Don't make all the letters the same size
    • Don't use the same shape for a single letter if repeated; apply transformations dynamically and randomly
    • Don't put the letters in a straight line.
    Also, you must provide an audio CAPTCHA as an alternative for visually-impaired people. This should speak the letters at different intervals, different volumes, in different pitches and in different timbres, with a background sound that varies to cover the whole of the frequency range used by the voices, with the transformations again applied randomly to each letter.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  8. #8
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Haha. Twey, audio? How would you even start going about that?
    How about audio that says "please get a friend who can read this to you". I mean.. yeah, it sucks for someone who's blind... but a random string into an audio file? Ouch.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  9. #9
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    Alot of work to do there, lol
    - Mike

  10. #10
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    I mean.. yeah, it sucks for someone who's blind... but a random string into an audio file? Ouch.
    There are several text-to-speech systems available. Have a look at Festival. You'd have to create the background sound first using something else, then create the sound using TTS, then merge the two. If you're not going to do the audio, then don't use a CAPTCHA at all: better to have a few spam messages on your pages than to block access to visually-impaired people (and since image CAPTCHAs are by necessity quite hard to read, it will be pretty much all visually-impaired people, not only those who are completely blind).
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •