Beispiel #1
0
<?php

include_once dirname(__FILE__) . '/Authentication.php';
include_once dirname(__FILE__) . '/StudIPAuthentication.php';
$auth = new Authentication();
$StudIPauth = new StudIPAuthentication();
$invalidLogin = Authentication::checkLogin() == false;
$shouldLogOut = isset($_GET['action']) && $_GET['action'] == "logout";
if ($invalidLogin == true || $shouldLogOut == true) {
    // the user's login is no longer valid or he requested to be logged out
    Authentication::logoutUser();
}
Beispiel #2
0
/**
 * Sends an HTTP DELETE request.
 *
 * Uses HTTP DELETE request to get contents a $url
 * @param string $url The URL that should be opnened.
 * @param bool $authbool If true then send sessioninformation in header.
 * @param string $message The Response Message e.g. 404. Argument is optional.
 * @param bool $sessiondelete If true then send a new timestamp. Only necessary
 * if $authbool true.
 */
function http_delete($url, $authbool, &$message = 0, $sessiondelete = false)
{
    $answer = Request::delete($url, array(), '', $authbool);
    if (isset($answer['status'])) {
        $message = $answer['status'];
    }
    if ($message == "401" && $sessiondelete == false) {
        Authentication::logoutUser();
    }
    return isset($answer['content']) ? $answer['content'] : '';
}