| Server IP : 202.61.199.114 / Your IP : 216.73.217.139 Web Server : nginx/1.22.1 System : Linux de.arni-solutions.de 6.1.0-49-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.174-1 (2026-05-26) x86_64 User : web20 ( 1018) PHP Version : 8.4.23 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /var/www/clients/client2/api.pacim.de/web/src/PaCIM/includes/ |
Upload File : |
<?php
# AUTH Token für API-Zugriff
define('PACIM_API_TOKEN', 'fN4kCee`@mdun5LU5dux');
if(isset($_GET['debug']) && $_GET['debug'] == 1) {
define('API_CONNECTION', 'PaCIM-Developer');
} else {
define('API_CONNECTION', 'PaCIM-PAS');
}
// Preisrechner
function get_parking_ground_price($type, $duration, $year = FALSE) {
$pathPrice = dirname(__FILE__) . "/price.json";
$year = ($year === FALSE ? date("Y") : $year);
if (!is_file($pathPrice)) { return FALSE; }
$priceData = json_decode( file_get_contents( $pathPrice ), true );
// Überprüfen, ob das Jahr im Preis-Array verfügbar ist
if ( !isset( $priceData[$year] ) ) {
$lastAvailableYear = max( array_keys( $priceData ) ); // Letztes verfügbares Jahr ermitteln
$year = $lastAvailableYear;
}
// Preisoptionen für das ausgewählte Jahr und Parkplatztyp
$aPricingOptions = [
"A" => $priceData[$year]["aussen"], // Außenstellplatz
"H" => $priceData[$year]["halle"] // Hallenstellplatz
];
$parkingTypeKey = strtoupper(substr($type, 0, 1)); // A oder H
// Preisdatensätze für das entsprechende Jahr laden
if (isset($aPricingOptions[$parkingTypeKey])) {
foreach ($aPricingOptions[$parkingTypeKey] as $key => $value) {
if (strpos($key, "-") !== false) {
[$minDays, $maxDays] = explode("-", $key);
} else {
$minDays = 21;
$maxDays = PHP_INT_MAX;
}
if ($duration >= $minDays && $duration <= $maxDays) {
$pGroundPrice = ($minDays >= 21) ? floatval($value) * $duration : floatval($value);
break;
}
}
}
return $pGroundPrice;
}
# User IP-Adresse ermitteln
function get_client_ip() {
$ipaddress = '';
if (getenv('HTTP_CLIENT_IP'))
$ipaddress = getenv('HTTP_CLIENT_IP');
else if(getenv('HTTP_X_FORWARDED_FOR'))
$ipaddress = getenv('HTTP_X_FORWARDED_FOR');
else if(getenv('HTTP_X_FORWARDED'))
$ipaddress = getenv('HTTP_X_FORWARDED');
else if(getenv('HTTP_FORWARDED_FOR'))
$ipaddress = getenv('HTTP_FORWARDED_FOR');
else if(getenv('HTTP_FORWARDED'))
$ipaddress = getenv('HTTP_FORWARDED');
else if(getenv('REMOTE_ADDR'))
$ipaddress = getenv('REMOTE_ADDR');
else
$ipaddress = 'UNKNOWN';
return $ipaddress;
}