how do i block spam using PHP?

Discussion in 'Software' started by jpmad4it, Jan 27, 2006.

  1. jpmad4it

    jpmad4it Private E-2

    hey people,

    i have a simple website. It has a HTML form where users can add data to my guestbook. This is done in the following order:

    - users fill out HTML form
    - once they submit the information the data is checked by an external PHP page to see if all the fields of the form have been filled out.
    - if all the fields are filled out then the PHP script connects to the database and enters the data.

    The problem is i have been getting loads of spam. Seeing that my script allows data to be added to the database if all fields of the form are filled out, spammers are just filling the fields with junk and crap and entering it to the database. It would be ideal if i could add some kind of PHP function that checks if the data sent from the HTML form is valid first. Can this be done? If so does anyone have a PHP function that i can test out?

    Its got so bad that i have taken parts of my site down due to the spam, so any help will be appreciated.

    Regards J
     
  2. Raits

    Raits Private E-2

    I don't think you can check the entery for valid words, but one thing you can do is have php check if the mail address is valid or not: google. Another thing you could do is set a cookie when the user enters a new post, but those can be avoided by turning them off. Another way would be to use sessions, which would mean they could post a new message after they have closed the browser. Or you could store the ip and check that that same ip hasn't been used too often already. The final thing i can think of is where the user has to write the numbers and text displayed on the pictures, but that would also be trouble for the honest people that want to post. All of these can be avoided though, just more trouble spamming you site.
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds