Your guestbook has Spam ?

December 6th, 2005 by Quatrux

Well a lot of people have problems with this, usually the bots find your guestbook and with time start adding some content about casino, gambling, viagra and medicine etc. this is so annoying, you get an email that somebody signed and you need to clean it, wow, what a waste of time ?! and other good robots might index it and that won’t look nice, your site might be thought of being spam one having links to porno sites :D so how can you protect from them, the bad robots ? well the first thing is banning, but as usually they have different IPs it does not help to much, the other thing is cookies, but usually those bots have cookies disabled and sends false headers, so it only might help from some guys spamming your guestbook, those idiots should be shot or their balls could be cut with a big big knife :) The best way is to have a random value of letters and numbers, though I prefer numbers, they look much nicer in the image, yeah so using for example with GD library create an image with that random value, do not forget to have random backgrounds, don’t use one colour, random positions of the letters or numbers, you might even use upper/lower case, but well this protection sometimes annoys the real users.. but that is life, you also should use sessions for this thing to work properly or any method you want. Here is a good PHP function which you can use to generate a value:

  1. < ?php
  3. function random_chars($length = ‘6′) {
  4.         /* Make Random Seed */  $value = ;
  5.         mt_srand((double) microtime() * 1000000);
  6.         $letters = "abcdefghijklmnopqrstuvwxyz"; /* add it if needed ‘123456789′ ‘ABCDEFGHIJKLMOPQRSTUVWXZ’ */
  7.                 for ($i = 0; $i < $length; $i++) {
  8.                         $value .= substr($letters, (mt_rand()%(strlen($letters))), 1);
  9.                 }
  10.         return $value;
  11. }
  13. ?>

So echo random_chars(); will parse a random value every time with the default length of 6, you can change the length you want.

Posted in PHP, Webmastering | 6 Comments »

6 Responses

  1. JosdUst Says:

    Hi Nice Site :)
    Who are you?

  2. GeshAsi Says:

    I run into a whole host references of him.
    He is a pen name to circumvent Israeli censors, and Shoher promotes unusual opinions about Middle East’s politics.

  3. Anonymous Says:

    He is thinking about taking the world and eliminating jews.

  4. felician Says:

    Hi dude!
    Christmas Day falls on December 25. It is preceded by Christmas Eve on December 24, and in some countries is followed by Boxing Day on December 26. Some Eastern Orthodox Churches celebrate Christmas on January 7, which corresponds to December 25 on the Julian calendar. December 25 as a birthdate for Jesus is merely traditional, and is not thought to be his actual date of birth.Good luck!

  5. ChristmasW Says:

    Best Christmas wishes!
    My Christmas wishes!
    Christmas wishes & Merry Christmas!

  6. itincomen Says:

    ??????? ??????? ??????????, ????? ? ???????.
    ???????? ???? ?????.
    ?? ????? ???????, ??????? ????? ? ??????????? ? ??????? ???????????.

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment and don't be afraid of the spam protection!