Current File : /home/users/kundensystem/www/inc/cookie.php
<?php
    $cookie_text=$ROW_setting['cookie'];
?>
<style type="text/css">
    .CookieView {
        display: none;
        position: fixed;
        width: 100%;
        height: 100%;
        top: 0px;
        z-index: 1000;
        background: rgba(0, 0, 0, 0.7);
        font-size: 14px;
    }
    .CookieViewCenter {
        display: flex;
        width: 100%;
        height: 100%;
        justify-content: center;
        align-items: center;
    }
    .CookieContainer {
        width: 600px;
        max-width:100%;
        background: #fff;
        border-radius: 10px;
    }
    .CookieTop {
        border-radius: 6px 6px 0 0;
        padding: 15px;
        border-bottom: 1px solid #e2e2e2;
    }
    .cookieLogo{
        height:30px;
    }
    .cookieContent p{
        margin-bottom:2px;
    }
</style>

<div class="CookieView" id="CookieView">
    <div class="CookieViewCenter">
        <div class="CookieContainer">
            <div class="CookieTop"><img class="cookieLogo" src="./assets/img/site_logo.png?v=<?= time(); ?>" /></div>
            <div class="padding13-20 border-bottom cookieContent">
                <?php echo $cookie_text; ?>
            </div>
            <div class="padding13-20 border-bottom spaceBetween align-center">
                <div>
                    <div class="fontBold">Funktional</div>
                    <div>Erforderlich, damit Sie wichtige Seitenfunktionen nutzen können.</div>
                </div>
                <div>
                    <label class="myCheck centerCheck">
                         <input type="checkbox" id="cookieCh1" checked>
                         <span class="checkmark"></span>
                    </label>                    
                </div>
            </div>
            <div class="padding13-20 border-bottom spaceBetween align-center">
                <div>
                    <div class="fontBold">Statistik</div>
                    <div>Verbessert unser Angebot für Sie.</div>
                </div>
                <div>
                    <label class="myCheck centerCheck">
                         <input type="checkbox" id="cookieCh2">
                         <span class="checkmark"></span>
                    </label>                    
                </div>
            </div>
            <div class="padding13-20 border-bottom spaceBetween align-center">
                <div>
                    <div class="fontBold">Marketing</div>
                    <div>Ermöglicht für Sie passende Informationen anzuzeigen.</div>
                </div>
                <div>
                    <label class="myCheck centerCheck">
                         <input type="checkbox" id="cookieCh3">
                         <span class="checkmark"></span>
                    </label>                    
                </div>
            </div>
            <div class="text-right padding20">
                <button class="btn btn-danger btn-sm" onclick="setCookie('clicklink', 'yes', <?php echo $ROW_setting['cookie_days']; ?>)">
                    Einstellungen bestätigen
                </button>
                <button class="btn btn-success btn-sm" onclick="setCookie('clicklink', 'yes', <?php echo $ROW_setting['cookie_days']; ?>)">
                    Allen zustimmen
                </button>
            </div>
        </div>
    </div>
</div>

<script>
    function setCookie(cname, cvalue, exdays) {
        var d = new Date();
        d.setTime(d.getTime() + (exdays*2628000*7));
        var expires = "expires="+d.toUTCString();
        document.cookie = cname + "=" + cvalue + "; " + expires;
        document.getElementById('CookieView').style.display = 'none';
    }

    function getCookie(cname) {
        var name = cname + "=";
        var ca = document.cookie.split(';');
        for(var i=0; i<ca.length; i++) {
            var c = ca[i];
            while (c.charAt(0)==' ') c = c.substring(1);
            if (c.indexOf(name) == 0) return c.substring(name.length,c.length);
        }
        return "";
    }

    var cookieString = getCookie("clicklink");
    if(cookieString == "yes"){
        document.getElementById('CookieView').style.display = 'none';
    } else {
        document.getElementById('CookieView').style.display = 'block';
    }

</script>