<?php

    // configuration
    require_once(dirname(__FILE__) . "/config.php");

    // if user is already logged in, log out
    if (isset($_SESSION["mail"]))
        unset($_SESSION["mail"]);
    if (isset($_SESSION["displayName"]))
        unset($_SESSION["displayName"]);

    // redirect user to index.php
    $protocol = (isset($_SERVER["HTTPS"])) ? "https" : "http";
    $host  = $_SERVER["HTTP_HOST"];
    $path = rtrim(dirname($_SERVER["PHP_SELF"]), "/\\");
    header("Location: {$protocol}://{$host}{$path}/index.php");

?>
