Slide 24
Slide 24 text
...
$vicenty = new VicentyService();
$lines = [];
foreach($dataset->getSamples() as $key => $sample) {
if ($access->getIp() == $sample[0] && $access->getUser() !==
$target) {
$arrFrom = [$access->getLatitude(), $access->getLongitude()];
$arrTo = [$sample[4], $sample[5]];
$diffDistance = $vicenty->distance($arrFrom, $arrTo);
if ($diffDistance > 0) {
$lines[] = sprintf('%s,%s,%s,%s,%s', $arrFrom['lat'],
$arrFrom['lon'], $arrTo['lat'], $arrTo['lon'],
$diffDistance) . PHP_EOL;
}
}
}
}
file_put_contents('data/datasets/suspect-access.csv', $lines);