<?php
include "mysql.php";

function getFooter(){
    include "mysql.php";
    include "config.php";

    $newestPost = "";

    $result = $conn->query("SELECT * FROM posts order by id desc limit $footerMaxPost");
    if ($result->num_rows > 0) {
        while ($row = $result->fetch_assoc()) {
            $title = $row["title"];
            $id = $row["id"];
            $newestPost .= "<a href=\"/post.php?id=$id\">$title</a><br>";
        }
    }


    echo (<<<EOF
    </div>
    <footer>
    <div id="blueBar"></div>
    <div id="footerContent">
    <div>
        <a href="/datenschutzerklaerung.php">Datenschutzerkl&auml;rung</a><br>
        <a href="/bildquellen.php">Bildquellen</a><br>
        <a href="/impressum.php">Impressum</a><br>
    </div>
    <div id="newestPost">
        <h3>Neueste Beitr&auml;ge:</h3>
        $newestPost
    </div>
    <div class="center">
        <p class="center">
            <a href="https://www.instagram.com/jonasled1/"><i class="fa fa-instagram fa-2x"></i></a><i class="footerIconSpacer"></i>
            <a href="https://www.thingiverse.com/jonasled/designs/"><i class="fa fa-cubes fa-2x"></i></a><i class="footerIconSpacer"></i>
            <a href="https://paypal.me/jonasled/"><i class="fa fa-paypal fa-2x"></i></a><i class="footerIconSpacer"></i>
            <a href="https://matrix.jonasled.de/invite/#/@jonasled:jonasled.de"><i class="fa fa-matrix-org fa-2x"></i></a>
        </p>
    </div>
    </div>
    </footer>
        <div class="cookieinfo">
        <div class="cookieinfo-close">
            ✖
        </div>
        <span class="cookieinfo-text">
               We use cookies to enhance your experience. By continuing to visit this site you agree to our use of cookies. <a class="cookieinfo-link" href="http://wikipedia.org/wiki/HTTP_cookie">More info</a>
            </span>
    </div>
    <script src="/js/script.js"></script>
    </body>
    </html>
    EOF);
}
