} else {
                    echo "<p style='color: red'>Your message is to long. (max 65535 characters)</p>";
                    echo "<p style='color: red'>Seriously, how did you do that?</p>";
                }
            } else {
                $senderId = $_SESSION['user']['gebruikersId'];
                if (portfolio_send_message($senderId, $recieverId, $subject, $message)) {
                    echo '<p>Bericht verzonden</p>';
                } else {
                    echo '<p>Kon bericht niet verzenden</p>';
                }
            }
        }
    }
    echo "<p><form method='post' action='" . $_SERVER['PHP_SELF'] . "'></p>" . "<p>Send to: <select name='reciever'>";
    $users = portfolio_get_users();
    foreach ($users as $s) {
        if ($recieverId === $s['gebruikersId']) {
            echo "<option value='" . $s['gebruikersId'] . "' selected='selected'>" . $s['voornaam'] . ' ' . $s['achternaam'] . ':     ' . $s['rol'] . "</option>";
        } else {
            echo "<option value='" . $s['gebruikersId'] . "'>" . $s['voornaam'] . ' ' . $s['achternaam'] . ':     ' . $s['rol'] . "</option>";
        }
    }
    echo "</select></p>";
    echo "<p>Subject: <input type='text' name='subject' value='" . htmlentities($subject) . "'> (max 155 characters)</p>";
    //Vervang newlines met breaks zodat het goed wordt weergeven!
    echo "<p>Message :</p><p><textarea name='message' rows='20' cols='100'>" . htmlentities($message) . "</textarea></p>";
    echo "<p><input type='submit' name='send' value='send'></p>";
    echo "</form>";
}
?>
    <body>
        
        <div id="container">
            <div id="header">
                <?php 
include 'inc/header.php';
?>
            </div>
            <div id="content">
            <?php 
if (isset($_SESSION['user'])) {
    if (portfolio_user_is_of_type(array('admin'))) {
        echo "<h2>Welkom " . $_SESSION['user']['voornaam'] . " " . $_SESSION['user']['achternaam'] . "</h2>";
        echo '<p><a href="adduser.php">Maak nieuwe gebruiker aan</a></p>';
        echo '<h3>Lijst gebruikers</h3>';
        $gebruikers = portfolio_get_users();
        if (count($gebruikers) > 0) {
            echo '<table class="tableLeft">';
            echo '<tr><th rel="col">naam</th><th rel="col">rol</th><th rel="col">details</th></tr>';
            foreach ($gebruikers as $vak) {
                echo '<tr>' . '<td>' . $vak['voornaam'] . ' ' . $vak['achternaam'] . '</td>' . '<td>' . $vak['rol'] . '</td>' . '<td><a href="viewuser.php?user='******'gebruikersId'] . '">bekijk</a></td>' . '</tr>';
            }
            echo '</table>';
        } else {
            echo '<p>Er zijn geen vakken gevonden</p>';
        }
    }
} else {
    echo "<h2>Log eerst in!</h2>";
    echo '<p><a href="login.php">Klik hier om in te loggen</a></p>';
}