Beispiel #1
0
            $host = NULL;
        }
    } else {
        $host = 'darwin.bournemouth.ac.uk';
        $secure = TRUE;
    }
    setrawcookie($DARWINCOOKIENAME, $authtoken, $cookieexpire, '/', $host, $secure);
    error_log(__FILE__ . ": Cookie set.");
    if (isset($_REQUEST['redirect'])) {
        error_log(__FILE__ . ": redirecting");
        header('Location: ' . $_REQUEST['redirect']);
        echo "Redirect!\n";
    } else {
        if ($htmloutput) {
            error_log(__FILE__ . ": Showing success screen");
            showSuccessScreen($_REQUEST['newuser']);
        } else {
            error_log(__FILE__ . ": Setting success");
            echo "login:"******"\n";
            for ($x = 0; $x < 0; $x++) {
                echo "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n";
            }
        }
    }
    error_log(__FILE__ . ": Cleaning tokens");
    $epoch = time();
    cleanTokens($db, $epoch);
    error_log(__FILE__ . ": Closing database");
    $db->close();
} else {
    error_log("Could not get database connection");
Beispiel #2
0
        checkBindParam($db, $stmt, "ss", $requestip, $authtoken);
        checkExecute($db, $stmt);
        $stmt->close();
        $db->commit();
        cleanTokens($db);
        $db->close();
    }
    // Whatever happens set the user for the rest of the page to null.
    setDarwinUser(NULL);
    if (isset($_REQUEST['redirect'])) {
        header('Location: ' . $_REQUEST['redirect']);
        exit;
        // Finished
    } else {
        if ($htmloutput) {
            showSuccessScreen();
        } else {
            echo "logout:{$user}";
        }
    }
} else {
    if (isset($_REQUEST['redirect'])) {
        header('Location: ' . $_REQUEST['redirect']);
        exit;
        // Finished
    } else {
        if ($htmloutput) {
            darwinHeader("Not logged in", "You were not logged in.");
            darwinFooter();
        } else {
            echo "error:Not logged in";
Beispiel #3
0
         }
     } else {
         $host = 'darwin.bournemouth.ac.uk';
         $secure = TRUE;
     }
     error_log(__FILE__ . ": The host for the cookie has been determined as '{$host}'");
     setrawcookie($DARWINCOOKIENAME, $authtoken, $cookieexpire, '/', $host, $secure);
     error_log(__FILE__ . ": Cookie set.");
     if (isset($_REQUEST['redirect'])) {
         error_log(__FILE__ . ": redirecting");
         header('Location: ' . $_REQUEST['redirect']);
         echo "Redirect!\n";
     } else {
         if ($htmloutput) {
             error_log(__FILE__ . ": Showing success screen");
             showSuccessScreen($db, $_REQUEST['username']);
         } else {
             error_log(__FILE__ . ": Setting success");
             echo "login:"******"\n";
             for ($x = 0; $x < 0; $x++) {
                 echo "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n";
             }
             //             flush();
         }
     }
 } else {
     error_log(__FILE__ . ": user info incorrect");
     if ($htmloutput) {
         presentLoginScreen('Username or password not correct');
     } else {
         http_response_code(401);