Skip to content
This repository was archived by the owner on Apr 9, 2023. It is now read-only.

Commit 4656bed

Browse files
committed
Anonymise ip adress by default
1 parent 74536e2 commit 4656bed

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

analytics.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -316,14 +316,14 @@ function getlocation() {
316316
}
317317
}
318318

319-
// Anonymizes the ip adress (might required in germany)
319+
// Anonymizes the ip adress
320320
function anonymize_ip() {
321321
//We add a prefix to reduce the chance of having two or more ip adresses with the same name.
322322
$prefix = "ipv4";
323323
if(filter_var($this->u_ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
324324
$prefix = "ipv6";
325325
}
326-
$anonymous_ip = $prefix + "." + md5($this->u_ip);
326+
$this->u_ip = $prefix + "." + md5($this->u_ip);
327327
}
328328

329329
// Gives the ISP an unique id
@@ -356,7 +356,7 @@ function getunid($mysql) {
356356
}
357357
} else {
358358
$this->unid = $this->generateid(15);
359-
$this->exgenquery($mysql, "networks", array("ip" => $this->user_ip, "host" => $this->u_host, "country" => $this->u_country_code, "isp_id" => $this->isp_id), $this->unid);
359+
$this->exgenquery($mysql, "networks", array("ip" => $this->u_ip, "host" => $this->u_host, "country" => $this->u_country_code, "isp_id" => $this->isp_id), $this->unid);
360360
}
361361
}
362362

@@ -576,6 +576,9 @@ function __construct($mysql, $server, $clientcookies, $anonymousips = TRUE) {
576576
} else { $this->d = $domain; }
577577
$this->getmobile();
578578
$this->getlocation($reader);
579+
if($anonymousips) {
580+
anonymize_ip();
581+
}
579582
$this->getisp($mysql);
580583
$this->getunid($mysql);
581584
$this->getbot();

0 commit comments

Comments
 (0)