showexp.php3 1.83 KB
Newer Older
Leigh B. Stoller's avatar
Leigh B. Stoller committed
1
2
<?php
include("defs.php3");
3
include("showstuff.php3");
Leigh B. Stoller's avatar
Leigh B. Stoller committed
4

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

10
11
12
#
# Only known and logged in users can end experiments.
#
13
$uid = GETLOGIN();
14
LOGGEDINORDIE($uid);
Leigh B. Stoller's avatar
Leigh B. Stoller committed
15

16
17
$isadmin = ISADMIN($uid);

Leigh B. Stoller's avatar
Leigh B. Stoller committed
18
#
19
20
# Verify form arguments.
# 
21
22
23
24
25
if (!isset($exp_pideid) ||
    strcmp($exp_pideid, "") == 0) {
    USERERROR("You must provide an experiment ID.", 1);
}

Leigh B. Stoller's avatar
Leigh B. Stoller committed
26
#
27
28
29
30
31
32
33
# First get the project (PID) from the form parameter, which came in
# as <pid>$$<eid>.
#
$exp_eid = strstr($exp_pideid, "$$");
$exp_eid = substr($exp_eid, 2);
$exp_pid = substr($exp_pideid, 0, strpos($exp_pideid, "$$", 0));

Leigh B. Stoller's avatar
Leigh B. Stoller committed
34
#
35
# Check to make sure thats this is a valid PID/EID tuple.
Leigh B. Stoller's avatar
Leigh B. Stoller committed
36
37
#
$query_result = mysql_db_query($TBDBNAME,
38
39
40
41
42
	"SELECT * FROM experiments WHERE ".
        "eid=\"$exp_eid\" and pid=\"$exp_pid\"");
if (mysql_num_rows($query_result) == 0) {
  USERERROR("The experiment $exp_eid is not a valid experiment ".
            "in project $exp_pid.", 1);
Leigh B. Stoller's avatar
Leigh B. Stoller committed
43
44
}

45
46
47
48
#
# Verify that this uid is a member of the project for the experiment
# being displayed.
#
49
50
if (!$isadmin) {
    $query_result = mysql_db_query($TBDBNAME,
51
	"SELECT pid FROM proj_memb WHERE uid=\"$uid\" and pid=\"$exp_pid\"");
52
53
54
55
    if (mysql_num_rows($query_result) == 0) {
        USERERROR("You are not a member of Project $exp_pid for ".
                  "Experiment: $exp_eid.", 1);
    }
Leigh B. Stoller's avatar
Leigh B. Stoller committed
56
57
58
}

#
59
# Dump experiment record.
Leigh B. Stoller's avatar
Leigh B. Stoller committed
60
# 
61
SHOWEXP($exp_pid, $exp_eid);
62

63
64
65
66
67
68
# Terminate option.
echo "<p><center>
       Do you want to terminate this experiment?
       <A href='endexp.php3?exp_pideid=$exp_pid\$\$$exp_eid'>Yes</a>
      </center>\n";    

69
#
70
71
72
73
# Dump the node information.
#
SHOWNODES($exp_pid, $exp_eid);
    
Leigh B. Stoller's avatar
Leigh B. Stoller committed
74
75
#
# Lets dump the project information too.
76
#
Leigh B. Stoller's avatar
Leigh B. Stoller committed
77
78
echo "<center>
      <h3>Project Information</h3>
79
      </center>\n";
80
SHOWPROJECT($exp_pid, $uid);
Leigh B. Stoller's avatar
Leigh B. Stoller committed
81

82
83
84
85
#
# Standard Testbed Footer
# 
PAGEFOOTER();
86
?>