$text\n"; # # XXX these blanks look bad in lynx, but add required # spacing between menu and body # echo "   \n"; echo " \n"; } # # WRITESIDEBAR(): Write the menu. The actual menu options the user # sees depends on the login status and the DB status. # function WRITESIDEBAR() { global $login_status, $login_message, $error_message, $uid, $TBDBNAME; global $STATUS_NOSTATUS, $STATUS_LOGGEDIN, $STATUS_LOGGEDOUT; global $STATUS_LOGINFAIL, $STATUS_TIMEDOUT, $STATUS_NOLOGINS; global $TBBASE, $TBDOCBASE; echo "\n"; WRITESIDEBARBUTTON("Home", $TBBASE, "index.php3"); WRITESIDEBARBUTTON("Publications", $TBDOCBASE, "pubs.php3"); WRITESIDEBARBUTTON("Documentation", $TBDOCBASE, "doc.php3"); WRITESIDEBARBUTTON("FAQ", $TBDOCBASE, "faq.php3"); WRITESIDEBARBUTTON("Tutorial", $TBDOCBASE, "tutorial/tutorial.php3"); WRITESIDEBARBUTTON("People", $TBDOCBASE, "people.php3"); echo "\n"; if ($login_status == $STATUS_NOLOGINS) { WRITESIDEBARBUTTON("Web Interface Temporarily Unavailable", $TBDOCBASE, "nologins.php3"); echo "\n"; } elseif ($login_status == $STATUS_LOGGEDIN) { $query_result = mysql_db_query($TBDBNAME, "SELECT status,admin,stud FROM users WHERE uid='$uid'"); $row = mysql_fetch_row($query_result); $status = $row[0]; $admin = $row[1]; $stud = $row[2]; # # See if group_root in any projects, not just the last one in the DB! # $query_result = mysql_db_query($TBDBNAME, "SELECT trust FROM proj_memb ". "WHERE uid='$uid' and trust='group_root'"); if (mysql_num_rows($query_result)) { $trusted = 1; } else { $trusted = 0; } if ($status == "active") { if ($admin) { WRITESIDEBARBUTTON("New Project Approval", $TBBASE, "approveproject_list.php3"); WRITESIDEBARBUTTON("Node Control", $TBBASE, "nodecontrol_list.php3"); WRITESIDEBARBUTTON("User List", $TBBASE, "showuser_list.php3"); } if ($trusted) { # Only group leaders can do these options WRITESIDEBARBUTTON("New User Approval", $TBBASE, "approveuser_form.php3"); } # # Since a user can be a member of more than one project, # display this option, and let the form decide if the user is # allowed to do this. # WRITESIDEBARBUTTON("Project Information", $TBBASE, "showproject_list.php3"); WRITESIDEBARBUTTON("Begin an Experiment", $TBBASE, "beginexp_form.php3"); WRITESIDEBARBUTTON("Experiment Information", $TBBASE, "showexp_list.php3"); WRITESIDEBARBUTTON("Create a Batch Experiment", $TBBASE, "batchexp_form.php3"); WRITESIDEBARBUTTON("Update user information", $TBBASE, "modusr_form.php3"); WRITESIDEBARBUTTON("Node Reservation Status", $TBBASE, "reserved.php3"); WRITESIDEBARBUTTON("Node Up/Down Status", $TBDOCBASE, "updown.php3"); } elseif (($status == "newuser") || ($status == "unverified")) { WRITESIDEBARBUTTON("New User Verification", $TBBASE, "verifyusr_form.php3"); } elseif ($status == "unapproved") { $error_message = "Your account has not been approved yet. ". "Please try back later"; } } # # Standard options for anyone. # if ($login_status != $STATUS_NOLOGINS) { WRITESIDEBARBUTTON("Start Project", $TBBASE, "newproject_form.php3"); WRITESIDEBARBUTTON("Join Project", $TBBASE, "addusr.php3"); } switch ($login_status) { case $STATUS_LOGGEDIN: $login_message = "$uid Logged In"; break; case $STATUS_LOGGEDOUT: $login_message = "Logged Out"; break; case $STATUS_LOGINFAIL: $login_message = "Login Failed"; break; case $STATUS_TIMEDOUT: $login_message = "Login Timed Out"; break; case $STATUS_NOLOGINS: $login_message = "Please Try Again Later"; break; } # # Now the login/logout box. Remember, already inside a table. # echo "\n"; if ($login_status == $STATUS_LOGGEDIN) { echo "\n"; } else { # # Get the UID that came back in the cookie so that we can present a # default login name to the user. # if (($uid = GETUID()) == FALSE) { $uid = ""; } echo "\n"; } echo "\n"; if ($login_message) { echo "\n"; } # # MOTD. Set this with the webcontrol script. # # The blinking is for Mike, who says he really likes it. # $query_result = mysql_db_query($TBDBNAME, "SELECT message FROM loginmessage"); if (mysql_num_rows($query_result)) { $row = mysql_fetch_row($query_result); $message = $row[0]; echo "\n"; } echo "
Web Interface Options
Please Try Again Later
Username:
Password:
$login_message
$message

\n"; } # # WRITEBANNER(): write the page banner for a page. # Called by _STARTPAGE # function WRITEBANNER($title) { global $BANNERCOLOR, $THISPROJECT, $THISHOMEBASE; echo "\n"; echo ""; echo "
$THISHOMEBASE
$THISPROJECT
\n"; } # # _WRITETITLE(title): write the page title for a page. # Called by _STARTPAGE # function WRITETITLE($title) { global $TITLECOLOR; echo "
\n"; # # Insert a small logo here if you like. # echo " $title
\n"; } # # Spit out a vanilla page header. # function PAGEHEADER($title) { global $login_status, $TBAUTHTIMEOUT, $uid; global $STATUS_NOSTATUS, $STATUS_LOGGEDIN, $STATUS_LOGGEDOUT; global $STATUS_LOGINFAIL, $STATUS_TIMEDOUT, $STATUS_NOLOGINS; global $TBBASE, $TBDOCBASE, $TBDBNAME; if ($login_status == $STATUS_NOSTATUS) { if ($uid = GETUID()) { # # Check to make sure the UID is logged in (not timed out). # $status = CHECKLOGIN($uid); switch ($status) { case 0: unset($uid); break; case 1: $login_status = $STATUS_LOGGEDIN; break; case -1: $login_status = $STATUS_TIMEDOUT; unset($uid); break; } } } # # Check for NOLOGINS. This is complicated by the fact that we # want to allow admin types to continue using the web interface, # and logout anyone else that is currently logged in! # if ($login_status == $STATUS_LOGGEDIN && NOLOGINS()) { $query_result = mysql_db_query($TBDBNAME, "SELECT admin FROM users WHERE uid='$uid'"); $row = mysql_fetch_row($query_result); $admin = $row[0]; if (!$admin) { DOLOGOUT($uid); $login_status = $STATUS_NOLOGINS; } } elseif (NOLOGINS()) { $login_status = $STATUS_NOLOGINS; } echo " Emulab.Net - $title\n"; # # Shove the Jave code through to the output. # readfile("java.html"); # # If logged in, initialize the refresh process. # if ($login_status == $STATUS_LOGGEDIN) { $timeo = $TBAUTHTIMEOUT + 120; echo "\n"; $timeo *= 1000; echo "\n"; } echo " \n"; # # If logged in, start the refresh process. # if ($login_status == $STATUS_LOGGEDIN) { echo "\n"; } else { echo "\n"; } echo "\n"; WRITEBANNER($title); WRITETITLE($title); echo "
\n"; WRITESIDEBAR(); echo " \n"; } # # ENDPAGE(): This terminates the table started above. # function ENDPAGE() { echo "


\n"; } # # Spit out a vanilla page footer. # function PAGEFOOTER() { global $TBBASE, $TBMAILADDR; ENDPAGE(); echo "
[Emulab.Net Home]
[Flux Research Group] [School of Computing] [University of Utah]

Problems? Contact $TBMAILADDR \n"; } ?>