suuser.php 917 Bytes
Newer Older
1 2 3
<?php
#
# EMULAB-COPYRIGHT
4
# Copyright (c) 2000-2003, 2006, 2007 University of Utah and the Flux Group.
5 6 7 8 9 10 11
# All rights reserved.
#
include("defs.php3");

#
# Only known and logged in users allowed.
#
12
$this_user = CheckLoginOrDie();
13

14
if (!ISADMIN()) {
15 16 17 18
    USERERROR("You do not have permission to do this!", 1);
}

#
19
# Verify arguments.
20
#
21
$reqargs = RequiredPageArguments("target_user", PAGEARG_USER);
Leigh B. Stoller's avatar
Leigh B. Stoller committed
22
$target_uid = $target_user->uid();
23

24
if (DOLOGIN_MAGIC($target_user->uid(), $target_user->uid_idx()) < 0) {
25 26 27
    USERERROR("Could not log you in as $target_uid", 1);
}
# So the menu and headers get spit out properly.
Leigh B. Stoller's avatar
Leigh B. Stoller committed
28
$_COOKIE[$TBNAMECOOKIE] = $target_uid;
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43

PAGEHEADER("SU as User");

echo "<center>";
echo "<br><br>";
echo "<font size=+2>You are now logged in as <b>$target_uid</b></font>\n";
echo "<br><br>";
echo "<font size=+1>Be Careful!</font>\n";
echo "</center>";

#
# Standard Testbed Footer
# 
PAGEFOOTER();
?>