showproject_form.php3 2.35 KB
Newer Older
1 2 3
<?php
include("defs.php3");

4 5 6 7 8
#
# Standard Testbed Header
#
PAGEHEADER("Show Experiment Information Form");

9 10 11 12 13 14
#
# Only known and logged in users can end experiments.
#
#
# Only known and logged in users can end experiments.
#
15
$uid = GETLOGIN();
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
LOGGEDINORDIE($uid);

#
# Admin users can do this.
#
$isadmin = ISADMIN($uid);
if (! $isadmin) {
    USERERROR("You do not have admin privledges!", 1);
}

#
# Show a menu of all projects.
#
$query_result = mysql_db_query($TBDBNAME,
	"SELECT pid FROM projects");
if (! $query_result) {
    $err = mysql_error();
    TBERROR("Database Error getting project list: $err\n", 1);
}
if (mysql_num_rows($query_result) == 0) {
    USERERROR("There are no projects!", 1);
}

while ($projectrow = mysql_fetch_array($query_result)) {
    $pid      = $projectrow[pid];
    $headuid  = $projectrow[head_uid];
    $Purl     = $projectrow[URL];
    $Pname    = $projectrow[name];
    $Paffil   = $projectrow[affil];

}

#
# Lets see if the user is even part of any experiements before
# presenting a bogus option list.
#
$experiments = "";
while ($projrow = mysql_fetch_array($projmemb_result)) {
    $pid = $projrow[pid];
    $exp_result = mysql_db_query($TBDBNAME,
	"SELECT eid FROM experiments WHERE pid=\"$pid\"");
    while ($exprow = mysql_fetch_array($exp_result)) {
        $eid = $exprow[eid];
        $experiments = "$experiments " .
                      "<option value=\"$pid\$\$$eid\">$pid/$eid</option>\n";
    }
}
if (strcmp($experiments, "") == 0) {
    USERERROR("There are no experiments running in any of the projects ".
              "you are a member of.", 1);
}

?>

<center>
<h1>Experiment Information Selection</h1>
<h2>Select an experiment from the list below.<br>
These are the experiments in the projects
you are a member of.</h2>
<table align="center" border="1">

<?php
78
echo "<form action=\"showexp.php3\" method=\"post\">";
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
echo "<tr>
          <td align='center'>Project/Experiment</td>
      </tr>\n";
echo "<tr></tr>";
echo "<tr></tr>";

#
# Suck the current info out of the database and display a list of
# experiments as an option list.
#
echo "<tr>";
echo "    <td><select name=\"exp_pideid\">";
echo "        $experiments";
echo "        </select>";
echo "    </td>
      </tr>\n";

?>
<td align="center">
<b><input type="submit" value="Submit"></b></td></tr>
</form>
</table>
</center>
102 103 104 105 106 107 108

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