All new accounts created on Gitlab now require administrator approval. If you invite any collaborators, please let Flux staff know so they can approve the accounts.

logout.php3 1.16 KB
Newer Older
1 2
<?php
#
Leigh B. Stoller's avatar
Leigh B. Stoller committed
3
# EMULAB-COPYRIGHT
4
# Copyright (c) 2000-2007 University of Utah and the Flux Group.
Leigh B. Stoller's avatar
Leigh B. Stoller committed
5 6
# All rights reserved.
#
7 8
require("defs.php3");

9
# Get current login.
10 11 12
$this_user = CheckLoginOrDie(CHECKLOGIN_MODMASK);
$uid       = $this_user->uid();
$isadmin   = ISADMIN();
13

14 15 16 17 18 19 20 21
#
# Verify page arguments.
#
$optargs = OptionalPageArguments("target_user",   PAGEARG_USER,
				 "next_page",     PAGEARG_STRING);

if (isset($target_user)) {
    # Only admin users can logout someone other then themself.
22
    if (!$isadmin && !$target_user->SameUser($this_user)) {
23 24
	PAGEHEADER("Logout");
	echo "<center>
25
                  <h3>You do not have permission to logout other users!</h3>
26 27 28 29 30 31
              </center>\n";
	PAGEFOOTER();
    }
}
else {
    $target_user = $this_user;
32
}
33 34
$target_user = $this_user;
$target_uid  = $uid;
35

36
if (DOLOGOUT($target_user) != 0) {
37 38 39 40 41
    PAGEHEADER("Logout");
    echo "<center><h3>Logout '$target_uid' failed!</h3></center>\n";
    PAGEFOOTER();
    return;
}
42 43

#
44 45
# Success. Zap the user back to the front page, in nonsecure mode, or a page
# the caller specified
46
# 
47
if (isset($next_page)) {
48 49 50 51
    header("Location: $next_page");
} else {
    header("Location: $TBBASE/");
}
52
?>
53 54