Commit 106740ef authored by Mac Newbold's avatar Mac Newbold

Make adminmode toggle use toggle.php like everything else, instead of a separate script.

parent de553419
<?php
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2002 University of Utah and the Flux Group.
# All rights reserved.
#
include("defs.php3");
#
# No PAGEHEADER since we spit out a Location header later. See below.
#
#
# Only known and logged in users can do this.
#
# Note different test though, since we want to allow logged in
# users with expired passwords to change them.
#
$uid = GETLOGIN();
LOGGEDINORDIE($uid);
#
# Admins can change status for other users.
#
if (!isset($target_uid)) {
$target_uid = $uid;
}
#
# We need to know the real admin permission of the current user.
#
if (! ($CHECKLOGIN_STATUS & CHECKLOGIN_ISADMIN)) {
USERERROR("You do not have permission to use this page!", 1);
}
if (!isset($adminoff) || ($adminoff != 0 && $adminoff != 1)) {
USERERROR("Improper arguments!", 1);
}
DBQueryFatal("update users set adminoff=$adminoff where uid='$target_uid'");
#
# Spit out a redirect
#
if (isset($HTTP_REFERER) && strcmp($HTTP_REFERER, "")) {
header("Location: $HTTP_REFERER");
}
else {
header("Location: $TBBASE/showuser.php3?target_uid=$target_uid");
}
?>
...@@ -517,12 +517,12 @@ function PAGEHEADER($title) { ...@@ -517,12 +517,12 @@ function PAGEHEADER($title) {
if ($login_uid && ISADMINISTRATOR()) { if ($login_uid && ISADMINISTRATOR()) {
if (ISADMIN($login_uid)) { if (ISADMIN($login_uid)) {
echo "<a href=adminmode.php3?target_uid=$login_uid&adminoff=1> echo "<a href=toggle.php?target_uid=$login_uid&type=adminoff&value=1>
<img src='/redball.gif' <img src='/redball.gif'
border=0 alt='Admin On'></a>\n"; border=0 alt='Admin On'></a>\n";
} }
else { else {
echo "<a href=adminmode.php3?target_uid=$login_uid&adminoff=0> echo "<a href=toggle.php?target_uid=$login_uid&type=adminoff&value=0>
<img src='/greenball.gif' <img src='/greenball.gif'
border=0 alt='Admin Off'></a>\n"; border=0 alt='Admin Off'></a>\n";
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment