I'm trying to create a script to store IP adresses in a text file and than to count unique IP. For example if i have 3 different IP in the txt file
111.111.111.111
111.111.111.111
111.111.111.111
222.222.222.222
222.222.222.222
000.000.000.000
000.000.000.000
000.000.000.000
000.000.000.000
000.000.000.000
Than this is the result that i'm trying to have
111.111.111.111 = 3 (var = $total_visits)
222.222.222.222 = 2 (var = $total_visits)
000.000.000.000 = 5 (var = $total_visits)
I know that would be more realistic to built a database, but this function is for a special page that has a small number of users, let say 20-30 unique visitor per week.
My final goal is to warning the users like that:
$x = 5; // total visits of a unique IP;
if ($x > 6)
{
header('Location: http://example.com/banned.php');
}
elseif ($x > 5)
{
echo 'First Warn! Go away!';
}