Step 1. To get the client's ip, read this:
get-client-ip-address-using-php[
^]
Step 2. To get the partial ip from a valid ip in php, see example code:
$ipPart=explode('.', $clientIP);
if (count($ipPart) == 4)
{
$partialIP = $ipPart[0].'.'.$ipPart[1];
}
else {
$partialIP = 'UNKNOWN';
}
echo $partialIP;