Question : With PHP, what is the best way of detecting a user based on IP and updating it accordingly?

Hello everyone!

I have a script that stores players in a database that game on a particular server. I use this information to detect reported players and remove them if required using a PHP script.

Now, at current the best way I have of detecting which player is which is by using the IP split into each ocet, and checking the current stored against the one in the server for a first three match. Of course this will only work for players who have an IP that sticks to 192.168.0.XXX. Any host that changes the IP often will not be picked up. eg. 192.168.xxx.xxx

Example:

<?php

$ip = split_ip($player['ip']);

$query = mysql_query("SELECT * FROM reports WHERE  ip like  '" . $ip[0] . "." . $ip[1] . "." . $ip[2] . ".%'");

?>

So yes I could detect by two ocets over three, but what is the chance of this being unreliable? I could also check host eg. sky.com and the two ocet match, but again, what are the chances of picking up the wrong player?

So, my question is, what would be a reliable way of detecting a player using IP or other means?

Regards

Answer : With PHP, what is the best way of detecting a user based on IP and updating it accordingly?

I think that only you can answer that.  Take a look at your logs and see if you have a lot of similar IPs.  If you think that there are groups of players in an area with the same ISP, you could have problems.

I found a paper from 2007 that said that 50% of the dynamic IP blocks are larger than 256 addresses and 50% are that size or smaller.  Take your pick I guess.
Random Solutions  
 
programming4us programming4us