| Server IP : 85.158.181.41 / Your IP : 216.73.217.12 Web Server : Apache System : Linux cloud9-vm129 6.1.178+1-ph #ph SMP PREEMPT_DYNAMIC Wed Jul 29 09:00:54 UTC 2026 x86_64 User : moncbefd ( 1024) PHP Version : 7.3.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/moncbefd/www.moneta.at/ |
Upload File : |
<?php
/* --------------------------------------------------------------
ec_proxy.php 2019-10-23
Gambio GmbH
http://www.gambio.de
Copyright (c) 2019 Gambio GmbH
Released under the GNU General Public License (Version 2)
[http://www.gnu.org/licenses/gpl-2.0.html]
--------------------------------------------------------------
*/
declare(strict_types=1);
function getClientIp() {
$remoteAddressKey = 'REMOTE_ADDR';
$proxyHeader = 'HTTP_X_FORWARDED_FOR';
if (!array_key_exists($remoteAddressKey, $_SERVER)) {
return null;
}
if (array_key_exists($proxyHeader, $_SERVER)) {
$proxies = explode(',', $_SERVER[$proxyHeader]);
$clientIp = $proxies[0];
if (filter_var($clientIp, FILTER_VALIDATE_IP)) {
return $clientIp;
}
}
return $_SERVER[$remoteAddressKey];
}
$query = $_GET;
// parses the google path to extract the version query param
$gPath = $query['prx'];
$parsedGPath = parse_url($gPath);
if (array_key_exists('query', $parsedGPath)) {
$querySegments = explode('=', $parsedGPath['query']);
$query = array_merge([$querySegments[0] => $querySegments[1]], $query);
}
unset($query['prx']);
// creates the final google analytics url
$gUrl = 'https://www.google-analytics.com' . $parsedGPath['path'];
// try to fetch the client ip
$clientIp = getClientIp();
if ($clientIp) {
$query['uip'] = $clientIp;
}
if (array_key_exists('HTTP_USER_AGENT', $_SERVER)) {
$query['ua'] = $_SERVER['HTTP_USER_AGENT'];
}
// sends the analytics data to the google servers
$finalUrl = $gUrl . '?' . http_build_query($query);
$gCurl = curl_init($finalUrl);
curl_setopt($gCurl, CURLOPT_RETURNTRANSFER, true);
$gResponse = curl_exec($gCurl);
curl_close($gCurl);
header('Content-Type: image/gif');
echo $gResponse;