This function is what I used:
function getId ($ip) {
$ipData = file('idData/ips.txt');
$ipData = array_flip($ipData);
$id = $ipData[$ip] + 1;
return $id;
}
It is defined in idData.inc.php which is required in the file with the
problem (controlPanel.php).
I decided to ban a third
[snip]
But then it will go and do something like this:
Array (
[0] => 172.170.69.74
[1] => 172.141.183.231
[2] => 172.137.79.102
[3] => 172.151.144.242
[4] => 172.150.212.129
[5] => 172.158.154.92
) // correct array
Array (
[172.170.69.74 ] => 0
[172.141.183.231 ] => 1
[
For a logging system that I've been writing I came up with a way to asign
a unique id number to every IP address that visits the site. What I do
is append every *new* IP to a new line in a file (ips.txt). Then when I
have an IP and need the id I file() the ip log to put it in an array,
array_flip
3 matches
Mail list logo