Page 1 of 3 123 LastLast
Results 1 to 15 of 32

Thread: Blocking Robots

  1. #1
    Join Date
    Jun 2002
    Posts
    96

    Default Blocking Robots

    Has anyone changed thier submission forms to using random numbers to prevent robots from making submissions. I seem to be having problems with a gambling site bot trying to submit several times a day. IP banning is not working as they seem to be using proxys.
    Barney
    admin@allthingsphoto.com
    http://www.allthingsphoto.com

  2. #2
    Join Date
    Apr 2003
    Location
    Atlanta GA
    Posts
    3,395

    Default

    I don't know if this would work but you could try the following:

    in the ShowFormAddUrl function of add.php

    Code:
      global $ran_number;
    $ran_number = rand();
    
        DisplayTemplate($theme_path."add_form.html",
          "\$error_msg,\$ran_number,\$title,\$url,\$description,\$category,\$contact_name,\$email,\$add_cat1,\$add_cat2,\$keywords,\$custom_field_form".$custf);

    in the ProcessFormAddUrl function of add.php


    Code:
      global $r_number, $ran_number;
      if(empty($title)) $error_msg = $msg["10101"];
      elseif($r_number != $ran_number) $error_msg = "You must enter the confirmation number";
      elseif(empty($url) || $url == 'http://') $error_msg = $msg["10102"];
      elseif(empty($description)) $error_msg = $msg["10103"];
      elseif(empty($contact_name)) $error_msg = $msg["10104"];
      elseif(empty($email)) $error_msg = $msg["10105"];
      elseif (!IsEmailAddress($email)) $error_msg = $msg["10106"];
      elseif (!empty($bid) && !Ismoney($bid)) $error_msg = $msg["10107"];
    in add_form.html

    Code:
        <!-- remove <%custom_field_form%> if you want to generate field manualy -->
       	<!-- <%custom_field_form%> -->
            
        <tr class="tbl_normal">
          <td>Confirm</td>
          <td><input class=text3 type=text name=r_number size=10 value="">
    	  <br> please enter the number to the right to confirm: <%ran_number%>
    	  <input type="hidden" name="ran_number" value="<%ran_number%>">
    	  </td>
        </tr>
    
        <tr class="tbl_caption">
          <td colspan="2">
            <center>
            <input type=submit name=submit value="Submit your website">
    			  </center>
    			</td>
        </tr>
        </table>


    .
    esm
    "The older I get, the more I admire competence, just simple competence, in any field from adultery to zoology."

    .

  3. #3
    Join Date
    Jun 2002
    Posts
    96

    Default

    Thanks ESM, I will give it a try, getting a little tired of blocking IP's
    Barney
    admin@allthingsphoto.com
    http://www.allthingsphoto.com

  4. #4
    Join Date
    Apr 2003
    Location
    Atlanta GA
    Posts
    3,395

    Default

    I've seen it done with the crazy numbers/letters on a graphic image but the above only took about 10 minutes and I needed a break from the PAYPAL mod.

    I would be interested in how it works for you.



    .
    esm
    "The older I get, the more I admire competence, just simple competence, in any field from adultery to zoology."

    .

  5. #5
    Join Date
    Jun 2002
    Posts
    96

    Default

    It's not displaying the numbers, but no errors.
    Barney
    admin@allthingsphoto.com
    http://www.allthingsphoto.com

  6. #6
    Join Date
    Apr 2003
    Location
    Atlanta GA
    Posts
    3,395

    Default

    hmmm...it should work. I just copied it from my site.

    in order to get something from the php pages (add.php, in this case), you have to (1) declare the variable as global: global $ran_number; then (2) assign a value to it $ran_number = rand(); then (3) add it to the DisplayTemplate function ,\$ran_number.

    then in the template (4) create the tag code <%ran_number%> and then to get the data back to the PHP page (add.php), (5) use the variables in input statements: <input type="hidden" name="ran_number" value="<%ran_number%>"> and <input class=text3 type=text name=r_number size=10 value=""> and (6) then back in the PHP page, declare them to be global global $r_number, $ran_number;.


    Finally, use the variables
    elseif($r_number != $ran_number) $error_msg = "You must enter the confirmation number";

    Check it again...




    .
    esm
    "The older I get, the more I admire competence, just simple competence, in any field from adultery to zoology."

    .

  7. #7
    Join Date
    Jun 2002
    Posts
    96

    Default

    Here is what I have:

    function ShowFormAddUrl() {

    // vars global configuration
    global $dbServer, $dbHostname, $dbUsername, $dbPassword, $dbName,
    $category_separator, $theme_path, $HTTP_POST_VARS;

    // vars url & form
    global $cat;

    // vars messages
    global $msg;

    // validation
    global $ran_number;
    $ran_number = rand();

    // vars template
    global $error_msg, $title, $url, $description, $category, $contact_name, $email, $add_cat1, $add_cat2, $custom_field_form, $keywords;

    $title = $HTTP_POST_VARS['title'];


    if(empty($cat)) {
    DisplayTemplate($theme_path."add_error.html",
    "\$error_msg,\$ran_number,\$title,\$url,\$descript ion,\$category,\$contact_ name,\$email,\$add_cat1,\$add_cat2,\$keywords,\$cu stom_field_form".$custf);
    }
    else {

    if(empty($url)) $url = "http://";

    ------------------------------------------------
    // vars template
    global $error_msg, $password, $link_id, $title, $url, $description, $contact_name, $email, $bid, $category, $add_cat1, $add_cat2, $keywords ;


    $title = $HTTP_POST_VARS['title'];

    // verify input
    global $r_number, $ran_number;
    if(empty($title)) $error_msg = $msg["10101"];
    elseif($r_number != $ran_number) $error_msg = "You must enter the confirmation number";
    elseif(empty($url) || $url == 'http://') $error_msg = $msg["10102"];
    elseif(empty($description)) $error_msg = $msg["10103"];
    elseif(empty($contact_name)) $error_msg = $msg["10104"];
    elseif(empty($email)) $error_msg = $msg["10105"];
    elseif (!IsEmailAddress($email)) $error_msg = $msg["10106"];
    elseif (!empty($bid) && !Ismoney($bid)) $error_msg = $msg["10107"];

    Maybe I have something in the wrong place.

    Thanks
    Barney
    admin@allthingsphoto.com
    http://www.allthingsphoto.com

  8. #8
    Join Date
    Apr 2003
    Location
    Atlanta GA
    Posts
    3,395

    Default

    Quote Originally Posted by esm
    in the ShowFormAddUrl function of add.php

    Code:
      global $ran_number;
    $ran_number = rand();
    
        DisplayTemplate($theme_path."add_form.html",
          "\$error_msg,\$ran_number,\$title,\$url,\$description,\$category,\$contact_name,\$email,\$add_cat1,\$add_cat2,\$keywords,\$custom_field_form".$custf);
    OK, I see. You added ,\$ran_number, to the wrong DisplayTemplate. Instead of using DisplayTemplate($theme_path."add_error.html", use the add_form.html one.



    .
    esm
    "The older I get, the more I admire competence, just simple competence, in any field from adultery to zoology."

    .

  9. #9
    Join Date
    Jun 2002
    Posts
    96

    Default

    Working great, once again ESM IS THE MAN!!!!

    Thanks Again
    Last edited by barnkin; 05-23-2005 at 08:17 PM.
    Barney
    admin@allthingsphoto.com
    http://www.allthingsphoto.com

  10. #10
    Join Date
    Apr 2003
    Location
    Atlanta GA
    Posts
    3,395

    Default

    in the land of the blind, the one-eyed man is KING.

    thanks for the comments but I'm still just a hacker and only a so-so hacker at that.

    let us know how it works. I guess I could do the "picture" thing if needed. but after the PAYPAL mod.



    .
    esm
    "The older I get, the more I admire competence, just simple competence, in any field from adultery to zoology."

    .

  11. #11
    Join Date
    Jun 2002
    Posts
    96

    Default

    No robots submissions for the first time in days, it works great

    Cheers
    Barney
    admin@allthingsphoto.com
    http://www.allthingsphoto.com

  12. #12
    Join Date
    Nov 2004
    Posts
    1,822

    Default

    i had 120 sites submitted and 340 posts on my forum all garbage. No idea what that was, but if it happens again i will give this ago.
    Main IndexU sites : | Campsite Directory | Tourist Guide | Places2B | AfterDirectory <-- Half price submission using coupon DP50 (from just $11 premium, and $10 basic permanent )

  13. #13
    Join Date
    Apr 2003
    Location
    Atlanta GA
    Posts
    3,395

    Default

    Quote Originally Posted by barnkin
    No robots submissions for the first time in days, it works great

    Cheers
    Now the question would be if it has hindered regular submissions...

    you can reduce the number of digits by using something like (I think):

    Code:
    $ran_number = rand(10000,99999);
    or

    Code:
    $ran_number = rand(100000,999999);


    .
    esm
    "The older I get, the more I admire competence, just simple competence, in any field from adultery to zoology."

    .

  14. #14
    Join Date
    Jun 2002
    Posts
    96

    Default

    Quote Originally Posted by esm
    Now the question would be if it has hindered regular submissions...

    you can reduce the number of digits by using something like (I think):

    Code:
    $ran_number = rand(10000,99999);
    or

    Code:
    $ran_number = rand(100000,999999);



    .
    I planned on trying that later today. I did a couple of test submissions and everything worked fine....if they want the site listed they will enter the number.
    Barney
    admin@allthingsphoto.com
    http://www.allthingsphoto.com

  15. #15
    Join Date
    May 2002
    Posts
    88

    Default

    This works awesome. I implemented it on the register.php page too.

    Thanks!

Similar Threads

  1. ip and useragent blocking
    By tjoerg in forum v3.2
    Replies: 3
    Last Post: 02-07-2005, 07:32 PM
  2. IP blocking?
    By Lea in forum v5.x
    Replies: 1
    Last Post: 12-24-2001, 04:26 PM

Posting Permissions

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