$error = "UID: Must supply a new UID"; } elseif (!TBvalid_uid($new_uid)) { $error = "UID: " . TBFieldErrorString(); } elseif (User::Lookup($new_uid) || posix_getpwnam($new_uid)) { $error = "UID: Already in use. Pick another"; } if ($error) { SPITFORM($target_user, $new_uid, $error); return; } # # Standard Testbed Header. # PAGEHEADER("Change login UID for user"); # Okay, call out to backend to change. STARTBUSY("Changing UID"); # # Run the backend script. # SUEXEC($uid, $TBADMINGROUP, "webchangeuid {$target_idx} {$new_uid}", SUEXEC_ACTION_USERERROR); # Stop the busy indicator and zap to user page. STOPBUSY(); PAGEREPLACE(CreateURL("showuser", $target_user)); # # Standard Testbed Footer # PAGEFOOTER(); ?>
echo "<form action='{$url}' method='post'>\n"; echo "<tr>\n <td>Use the text box (70 columns wide) to add a message to the\n email notification. </td>\n </tr>\n"; echo "<tr>\n <td align=center class=left>\n <textarea name=message rows=15 cols=70></textarea>\n </td>\n </tr>\n"; echo "<tr>\n <td align=center>\n <b><input type='submit' value='Submit' name='submit'></td>\n </tr>\n </form>\n </table>\n"; } # # On first load, display a virgin form and exit. # if (!isset($submit)) { SPITFORM($project, "", null); PAGEFOOTER(); return; } # If there is a message in the text box, it is appended below. if (!isset($message)) { $message = ""; } if (!($leader = $project->GetLeader())) { TBERROR("Error getting leader for {$pid}", 1); } $headuid = $leader->uid(); $headuid_email = $leader->email(); $headname = $leader->name(); SendProjAdminMail($pid, "ADMIN", "{$headname} '{$headuid}' <{$headuid_email}>", "Project '{$pid}' Approval", "\n" . "This message is to notify you that your project '{$pid}'\n" . "has been approved. We recommend that you save this link so that\n" . "you can send it to people you wish to have join your project.\n" . "Otherwise, tell them to go to {$TBBASE} and join it.\n" . "\n" . " {$TBBASE}/joinproject.php3?target_pid={$pid}\n" . "\n" . ($message != "" ? "{$message}\n\n" : "") . "Thanks,\n" . "Testbed Operations\n"); echo "<center>\n <h2>Done!</h2>\n </center><br>\n"; sleep(1); PAGEREPLACE(CreateURL("showproject", $project)); # # Standard Testbed Footer # PAGEFOOTER();
if ($retval < 0) { SUEXECERROR(SUEXEC_ACTION_CONTINUE); } # User error. Tell user and exit. if ($retval) { SUEXECERROR(SUEXEC_ACTION_USERERROR); PAGEFOOTER(); return; } # # Okay, lets zap back to the root, unless this was the root. # if ($template->IsRoot()) { PAGEREPLACE(CreateURL("showuser", $this_user)); } else { PAGEREPLACE("template_show.php?guid={$guid}&version=1"); } return; } # # Standard Testbed Header after argument checking. # PAGEHEADER("Template {$tid} ({$guid}/{$vers})"); SUBPAGESTART(); SUBMENUSTART("Template Options"); if ($template->IsActive()) { WRITESUBMENUBUTTON("InActivate Template    ", "{$this_url}&action=inactivate"); } else { WRITESUBMENUBUTTON("Activate Template    ", "{$this_url}&action=activate"); } WRITESUBMENUBUTTON("Modify Template", CreateURL("template_modify", $template));
$retval = SUEXEC($uid, "{$unix_pid},{$unix_gid}", "webtemplate_commit -e {$eid} {$guid}/{$vers}", SUEXEC_ACTION_IGNORE); /* Clear the 'loading' indicators above */ if ($retval) { CLEARBUSY(); } else { STOPBUSY(); } # # Fatal Error. Report to the user, even though there is not much he can # do with the error. Also reports to tbops. # if ($retval < 0) { SUEXECERROR(SUEXEC_ACTION_CONTINUE); } # User error. Tell user and exit. if ($retval) { SUEXECERROR(SUEXEC_ACTION_USERERROR); return; } # Zap to the newly created template page. $template->Refresh(); PAGEREPLACE("template_show.php?guid={$guid}&version=" . $template->child_vers()); # # In case the above fails. # echo "<center><b>Done!</b></center>"; echo "<br><br>\n"; # # Standard Testbed Footer # PAGEFOOTER();
if ($retval) { CLEARBUSY(); } else { STOPBUSY(); } # # Fatal Error. Report to the user, even though there is not much he can # do with the error. Also reports to tbops. # if ($retval < 0) { SUEXECERROR(SUEXEC_ACTION_CONTINUE); } # User error. Tell user and exit. if ($retval) { SUEXECERROR(SUEXEC_ACTION_USERERROR); return; } if (!isset($referrer)) { $referrer = CreateURL("template_show", $template); } # Zap back to template page. PAGEREPLACE($referrer); # # In case the above fails. # echo "<center><b>Done!</b></center>"; echo "<br><br>\n"; # # Standard Testbed Footer # PAGEFOOTER();
function DOTIME($instance, $action) { global $guid, $vers, $pid, $unix_pid, $unix_gid, $eid, $uid; $message = ""; $template = $instance->GetTemplate(); $experiment = $instance->GetExperiment(); if ($action == "pause") { PAGEHEADER("Pause Experiment Time"); $message = "Pausing experiment runtime"; } else { PAGEHEADER("Continue Experiment Time"); $message = "Continuing experiment runtime"; } $command_options = "-e {$eid} -a {$action} "; # # Avoid SIGPROF in child. # set_time_limit(0); echo $instance->ExpPageHeader(); echo "<br><br>\n"; echo "<script type='text/javascript' language='javascript' " . " src='template_sup.js'>\n"; echo "</script>\n"; STARTBUSY($message); # # Run the backend script. # $retval = SUEXEC($uid, "{$unix_pid},{$unix_gid}", "webtemplate_exprun {$command_options} {$guid}/{$vers}", SUEXEC_ACTION_IGNORE); HIDEBUSY(); # # Fatal Error. Report to the user, even though there is not much he can # do with the error. Also reports to tbops. # if ($retval < 0) { SUEXECERROR(SUEXEC_ACTION_CONTINUE); } # User error. Tell user and exit. if ($retval) { SUEXECERROR(SUEXEC_ACTION_USERERROR); return; } PAGEREPLACE(CreateURL("showexp", $experiment)); }
$optargs = OptionalPageArguments("user", PAGEARG_USER); $safe_peer = addslashes($peer); $query_result = DBQueryFatal("select * from emulab_peers " . "where name='{$safe_peer}' or urn='{$safe_peer}'"); if (!mysql_num_rows($query_result)) { USERERROR("Unknown peer: {$peer}", 1); } $row = mysql_fetch_array($query_result); $urn = $row['urn']; $url = $row['weburl']; # # Allow admin to xlogin as another user. # if (isset($user) && !$this_user->SameUser($user)) { if ($isadmin) { $uid = $user->uid(); } else { USERERROR("Not allowed to login as another user", 1); } } STARTBUSY("Contacting peer"); # # Do the xlogin, which gives us back a hash to stick in the redirect URL. # SUEXEC($uid, "nobody", "webmanageremote xlogin " . escapeshellarg($urn) . " {$uid}", SUEXEC_ACTION_DIE); STOPBUSY(); if (!preg_match("/^(\\w*)\$/", $suexec_output, $matches)) { TBERROR($suexec_output, 1); } $hash = $matches[1]; PAGEREPLACE("{$url}/peer_login.php?user={$uid}&key={$hash}");
include "defs.php3"; # # Only known and logged in users allowed. # $this_user = CheckLoginOrDie(); if (!ISADMIN()) { USERERROR("You do not have permission to do this!", 1); } # # Verify arguments. # $reqargs = RequiredPageArguments("target_user", PAGEARG_USER); $target_uid = $target_user->uid(); if (DOLOGIN_MAGIC($target_user->uid(), $target_user->uid_idx()) < 0) { USERERROR("Could not log you in as {$target_uid}", 1); } # So the menu and headers get spit out properly. $_COOKIE[$TBNAMECOOKIE] = $target_uid; 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>"; sleep(2); PAGEREPLACE($TBBASE); # # Standard Testbed Footer # PAGEFOOTER();