Spambots
Started on the old forum in March 2017 · view the original in the archive · old links redirect here
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
}
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.
In your registration.php Is this for lava? if so I don't have a copy of the original registration.
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.
add captcha code and email verification acount