Spambots

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spambots

    Someone signed up on my site like 70 times at one go but the names were same just added on a letter or a number same ip address....can anyone give me the slightest idea on how to prevent such....i believe we call them spambots

  • #2
    Here is a function to check ip against the last 5 users to prevent same ip address registering over and over again.

    PHP Code:
    function checkLastRegistrationsForIp($ip)
    {
        
    $lastUsers mysql_query("SELECT ip FROM member DESC LIMIT 5;")); //Change sql to your table name/row
        
    if(mysql_num_rows($lastUsers)>0)
        {
            while (
    $lastUser mysql_fetch_array($lastUsers))
            {
                if(
    $ip==$lastUser[0])
                {
                    return 
    true;
                }
            }
        }
            return 
    false;
    }


    /////////////////////////Usage:
    if(checkLastRegistrationsForIp($ip))
    {
        
    //dont allow registration

    Last edited by something else; 03.03.17, 09:19.

    Comment


    • #3
      Thanks bro good idea and I'm guessing this function goes in core?.....don't you think it would be better to add a like 2 mins interval between signing up again just saying what's your views?

      Comment


      • #4
        And wouldn't innocent people be blocked from this bro?

        Comment


        • #5
          A bot could be still registering 2 mins later so you might need to adjust times
          PHP Code:
          $ip $_SERVER['REMOTE_ADDR']; //Ip address maybe collected a different way than this, which could effect results.
          $lastTime mysql_fetch_array(mysql_query("SELECT MAX(registerTime) FROM members WHERE ip='".$ip."'")); //sql table name and rows "registerTime" and "ip" need changing
          if(time()<$lastTime[0]+120//120 = 60 secs * 2
          {
                       
          //block register

          People registering more than 1 account at a time are more than likely causing mischief - unless they have made a mistake on there registration.

          Comment


          • #6
            Thanks bro where should i put this code? and does cloudflare help in this matter?

            Comment


            • #7
              In your registration.php
              Is this for lava? if so I don't have a copy of the original registration.

              Comment


              • #8
                Yes bro it is for lava.......and placed it in registration thanks bro and what do you think about cloudsflare

                Comment


                • #9
                  Personally I would avoid them after cloudbleed, but I guess they can help to speed your site up.

                  This is a good quote about what they are about:
                  Cloudflare is essentially nothing more than a content delivery network (CDN). The theory behind it is that they will cache copies of your website to their servers, which are spread across different locations. When a visitor visits your site the server that is closest to them is chosen and the connection has less distance to travel, hence speeding up the load times. It will also attempt to serve a cached copy of your site if it ever goes down for some reason.

                  Comment


                  • #10
                    Thanks alot bro you've been helpful in so many ways and so many years on coding-talk god bless you....keep up the good work

                    Comment


                    • #11
                      add captcha code and email verification acount

                      Comment

                      Working...
                      X