Preventing zzzzz and junk data entries on a web based form

Discussion in 'PHP' started by ColorsAndChrome, Aug 13, 2012.

  1. #1
    I am going to develop some php based data entry forms where visitors will fill out a form with their name, address, etc
    this data will be written to a MySQL database

    Does anyone have any tips to prevent collecting bad data?

    for example First and Last name fields will be required, but a user can type anything in there to pass the "required" validation

    John
    Smith

    Mike
    Ryan

    the above are valid first/last names

    what if someone types

    zzzz
    yyyyy

    or

    rtrrtr
    jkjkkjkj

    they will pass the "required" validation but of course it is junk data

    any ideas regarding how someone handles this is appreciated

    AB
     
    ColorsAndChrome, Aug 13, 2012 IP
  2. MrLeN

    MrLeN Well-Known Member

    Messages:
    406
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    120
    #2
    The only thing you can really do is make sure you get them to validate their email, before they can continue.

    I always create forms that ask for:

    name, email

    Then when they submit the form, they get an activation link.

    Then they come back to the form and continue.

    There's not much you can do about the junk data, except maybe have that step in the process emailed to you (also), ie:

    "jkjkjkjkj has registered on your website"
    Click here to delete jkjkjkjkj

    Then, create a little script that will delete jkjkjkjkj.

    So that way you can manually check each new registration and very effectively get rid of that user with one click, if it is dodgy.

    Such a script should be exrtemely easy to write. The script could even include creating a text file which adds jkjkjkjkj, so if the same person comes back trying to register as jkjkjkjkj again, the script can check the text file and say: "Sorry jkjkjkjkj is an invalid name". That would also be extremely easy to write functionality for.

    You could also log the IP if the person who tried to register as jkjkjkjkj, and simply block that IP, because jkjkjkjkj is obviously an idiot -- and you wouldn't want them to register a second time, even if they did use a proper name.
     
    MrLeN, Aug 14, 2012 IP