djjjozsi, thank you for your reply.
Yes, I know, very often their are using proxy servers, but in my described situation - not. To make it more clear, happends the following.
$ipaddress = '41.208.152.53';
$countrycode = detectcountry($ipaddress);
if ($countrycode == 'SN') die;
$result = mysql_query("UPDATE users
SET country='$countrycode', $ipaddress='$ipaddress'
WHERE id='$id'")or die('MySQL Error');
The inserted data in DB are:
country = SN
ipaddress = 41.208.152.53
As you can see, the inserted IP address is the same as difined in the beginning of the script.
So, they bypass in some way:
$countrycode = detectcountry($ipaddress);
if ($countrycode == 'SN') die;
In my script I am using:
if (in_array($countrycode, $blocked)) die;
but it doesn't make any difference. I was testing the script several times and it stops when detects a forbidden country.
The only way to block spammers is to use:
if ($ipaddress == '41.208.152.53') die;
Then they change IP address or log in using proxy servers.
I am getting crazy - I don't understand why this script doesn't stop them.