showproject.php3 2.81 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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
<html>
<head>
<title>Show Project Information</title>
<link rel="stylesheet" href="tbstyle.css" type="text/css">
</head>
<body>
<?php
include("defs.php3");

#
# Note the difference with which this page gets it arguments!
# I invoke it using GET arguments, so uid and pid are are defined
# without having to find them in URI (like most of the other pages
# find the uid).
#

#
# Only known and logged in users can end experiments.
#
LOGGEDINORDIE($uid);

$isadmin = ISADMIN($uid);

#
# Verify form arguments.
# 
if (!isset($pid) ||
    strcmp($pid, "") == 0) {
    USERERROR("You must provide a project ID.", 1);
}

#
# Check to make sure thats this is a valid PID.
#
$query_result = mysql_db_query($TBDBNAME,
	"SELECT * FROM projects WHERE pid=\"$pid\"");
if (mysql_num_rows($query_result) == 0) {
  USERERROR("The project $pid is not a valid project.", 1);
}
$row = mysql_fetch_array($query_result);

#
# Verify that this uid is a member of the project for the experiment
# being displayed, or is an admin person.
#
if (!$isadmin) {
    $query_result = mysql_db_query($TBDBNAME,
	"SELECT pid FROM proj_memb WHERE uid=\"$uid\" and pid=\"$pid\"");
    if (mysql_num_rows($query_result) == 0) {
        USERERROR("You are not a member of Project $pid.", 1);
    }
}

echo "<center>
      <h3>Project Information</h3>
      </center>
      <table align=center border=1>\n";

$proj_created	= $row[created];
$proj_expires	= $row[expires];
$proj_name	= $row[name];
$proj_URL	= $row[URL];
$proj_head_uid	= $row[head_uid];
64
$proj_members   = $row[num_members];
65
66
67
$proj_pcs       = $row[num_pcs];
$proj_sharks    = $row[num_sharks];
$proj_why       = $row[why];
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
$control_node	= $row[control_node];

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

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

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

echo "<tr>
          <td>URL: </td>
          <td class=\"left\">
              <A href='$proj_URL'>$proj_URL</A></td>
      </tr>\n";

94
95
96
97
98
echo "<tr>
          <td>#Project Members: </td>
          <td class=\"left\">$proj_members</td>
      </tr>\n";

99
100
101
102
103
104
105
106
107
108
echo "<tr>
          <td>#PCs: </td>
          <td class=\"left\">$proj_pcs</td>
      </tr>\n";

echo "<tr>
          <td>#Sharks: </td>
          <td class=\"left\">$proj_sharks</td>
      </tr>\n";

109
110
111
112
113
echo "<tr>
          <td>Created: </td>
          <td class=\"left\">$proj_created</td>
      </tr>\n";

114
115
116
117
118
echo "<tr>
          <td>Expires: </td>
          <td class=\"left\">$proj_expires</td>
      </tr>\n";

119
echo "<tr>
120
121
122
123
124
          <td colspan='2'>Why?</td>
      </tr>\n";

echo "<tr>
          <td colspan='2' width=600>$proj_why</td>
125
126
127
128
129
130
131
132
      </tr>\n";

echo "</table>\n";

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