Spambots

Started on the old forum in March 2017 · view the original in the archive · old links redirect here

10 replies · 147 views · started 9 years ago · 1 min read

3 participants
tupac Developer · 95 posts #1

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

something else Fellow · 2,296 posts #2

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

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
}
tupac Developer · 95 posts #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?

tupac Developer · 95 posts #4

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

something else Fellow · 2,296 posts #5

A bot could be still registering 2 mins later so you might need to adjust times

$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.

tupac Developer · 95 posts #6

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

something else Fellow · 2,296 posts #7

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

tupac Developer · 95 posts #8

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

something else Fellow · 2,296 posts #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.

tupac Developer · 95 posts #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

Sign in to reply.

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close