Esempio n. 1
0
function GetUserId()
{
    if (IsAuthenticated()) {
        return $_SESSION['user_id'];
    }
    return -1;
}
function LogIn($url = '')
{
    $session_id = $_SESSION['session_id'];
    while (!IsAuthenticated()) {
        header('WWW-Authenticate: Basic realm="' . $session_id . '"');
        header('HTTP/1.1 401 Unauthorized');
        die('Authorization Required');
    }
    if (!empty($url)) {
        return TRUE;
    } else {
        header("Location: /auth/" . $_SESSION['session_id'] . "/", TRUE, 301);
    }
}
Esempio n. 3
0
    include 'inc/userDropdown.php';
    ?>
                                    </a>
                                </li>
                            <?php 
}
?>
                        </ul>
                    </nav>
                </div>
            </div>

            <div class="inner cover">
                <h1 class="cover-heading">Welcome</h1>
                <?php 
if (!IsAuthenticated()) {
    ?>
                    <p class="lead">Please login to continue.</p>
                    <p class="lead">
                        <a href="#" class="btn btn-lg btn-default" data-toggle="modal" data-target="#loginModal">Login</a>
                    </p>
                <?php 
} else {
    ?>
                    <p class="lead">Please continue to the dashboard</p>
                    <p class="lead">
                        <a href="panel.php" class="btn btn-lg btn-default">Continue</a>
                    </p>
                <?php 
}
?>