showexp.php3 2.65 KB
Newer Older
Leigh B. Stoller's avatar
Leigh B. Stoller committed
1
2
3
4
5
6
7
8
9
<html>
<head>
<title>Show Experiment Information</title>
<link rel="stylesheet" href="tbstyle.css" type="text/css">
</head>
<body>
<?php
include("defs.php3");

10
11
12
#
# Only known and logged in users can end experiments.
#
Leigh B. Stoller's avatar
Leigh B. Stoller committed
13
14
$uid = "";
if ( ereg("php3\?([[:alnum:]]+)",$REQUEST_URI,$Vals) ) {
15
16
    $uid=$Vals[1];
    addslashes($uid);
Leigh B. Stoller's avatar
Leigh B. Stoller committed
17
} else {
18
    unset($uid);
Leigh B. Stoller's avatar
Leigh B. Stoller committed
19
}
20
LOGGEDINORDIE($uid);
Leigh B. Stoller's avatar
Leigh B. Stoller committed
21
22

#
23
24
# Verify form arguments.
# 
25
26
27
28
29
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
30
#
31
32
33
34
35
36
37
# 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
38
#
39
# Check to make sure thats this is a valid PID/EID tuple.
Leigh B. Stoller's avatar
Leigh B. Stoller committed
40
41
#
$query_result = mysql_db_query($TBDBNAME,
42
43
44
45
46
	"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
47
}
48
$exprow = mysql_fetch_array($query_result);
Leigh B. Stoller's avatar
Leigh B. Stoller committed
49

50
51
52
53
#
# Verify that this uid is a member of the project for the experiment
# being displayed.
#
Leigh B. Stoller's avatar
Leigh B. Stoller committed
54
$query_result = mysql_db_query($TBDBNAME,
55
	"SELECT pid FROM proj_memb WHERE uid=\"$uid\" and pid=\"$exp_pid\"");
Leigh B. Stoller's avatar
Leigh B. Stoller committed
56
if (mysql_num_rows($query_result) == 0) {
57
58
  USERERROR("You are not a member of Project $exp_pid for ".
            "Experiment: $exp_eid.", 1);
Leigh B. Stoller's avatar
Leigh B. Stoller committed
59
60
61
62
63
64
65
66
67
}
?>

<center>
<h1>Experiment Information</h1>
<table align="center" border="1">

<?php

68
69
70
71
72
73
74
$exp_expires = $exprow[expt_expires];
$exp_name    = $exprow[expt_name];
$exp_created = $exprow[expt_created];
$exp_start   = $exprow[expt_start];
$exp_end     = $exprow[expt_end];
$exp_created = $exprow[expt_created];
$exp_head    = $exprow[expt_head_uid];
Leigh B. Stoller's avatar
Leigh B. Stoller committed
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90

#
# Generate the table.
# 
echo "<tr>
          <td>Name: </td>
          <td class=\"left\">$exp_eid</td>
      </tr>\n";

echo "<tr>
          <td>Long Name: </td>
          <td class=\"left\">$exp_name</td>
      </tr>\n";

echo "<tr>
          <td>Project: </td>
91
          <td class=\"left\">$exp_pid</td>
Leigh B. Stoller's avatar
Leigh B. Stoller committed
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
      </tr>\n";

echo "<tr>
          <td>Project Head: </td>
          <td class=\"left\">$exp_head</td>
      </tr>\n";

echo "<tr>
          <td>Created: </td>
          <td class=\"left\">$exp_created</td>
      </tr>\n";

echo "<tr>
          <td>Starts: </td>
          <td class=\"left\">$exp_start</td>
      </tr>\n";

echo "<tr>
          <td>Ends: </td>
          <td class=\"left\">$exp_end</td>
      </tr>\n";

echo "<tr>
          <td>Expires: </td>
          <td class=\"left\">$exp_expires</td>
      </tr>\n";

?>
</table>
</center>
</body>
</html>