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

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

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

#
# See what projects the uid is a member of. Must be at least one!
# 
$query_result = mysql_db_query($TBDBNAME,
19
	"SELECT pid FROM proj_memb WHERE uid=\"$uid\"");
Leigh B. Stoller's avatar
Leigh B. Stoller committed
20 21 22 23 24
if (! $query_result) {
    $err = mysql_error();
    TBERROR("Database Error finding project membership: $uid: $err\n", 1);
}
if (mysql_num_rows($query_result) == 0) {
25
    USERERROR("You do not appear to be a member of any Projects!", 1);
Leigh B. Stoller's avatar
Leigh B. Stoller committed
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
}

?>
<table align="center" border="1"> 
<tr>
    <td align="center" colspan="2">
        <h1>Begin a new Experiment on the Testbed</h1>
    </td>
</tr>

<tr>
    <td align="center" colspan="3">
        <em>(Fields marked with * are required)</em>
    </td>
</tr>

<?php
echo "<form enctype=\"multipart/form-data\"
            action=\"beginexp_process.php3\" method=\"post\">\n";

#
# UID to feed back. 
# 
echo "<tr>
          <td>*Username:</td>
          <td class=\"left\"> 
              <input type=\"readonly\" name=\"uid\" value=\"$uid\"></td>
      </tr>\n";

#
# Select Project
#
echo "<tr>
          <td>*Select Project:</td>";
echo "    <td><select name=\"exp_pid\">";
               while ($row = mysql_fetch_array($query_result)) {
62
                  $project = $row[pid];
Leigh B. Stoller's avatar
Leigh B. Stoller committed
63 64 65 66 67 68 69 70 71
                  echo "<option value=\"$project\">$project</option>\n";
               }
echo "       </select>";
echo "    </td>
      </tr>\n";

#
# Experiment ID and Long Name:
#
72
# Note DB max length.
73
#
Leigh B. Stoller's avatar
Leigh B. Stoller committed
74
echo "<tr>
75
          <td>*Name (no blanks):</td>
76
          <td><input type=\"text\" name=\"exp_id\"
77
                     size=$TBDB_EIDLEN maxlength=$TBDB_EIDLEN>
Leigh B. Stoller's avatar
Leigh B. Stoller committed
78 79 80 81
              </td>
      </tr>\n";

echo "<tr>
82 83
          <td>*Long Name:</td>
          <td><input type=\"text\" name=\"exp_name\" size=\"40\">
Leigh B. Stoller's avatar
Leigh B. Stoller committed
84 85 86 87 88 89 90 91 92 93
              </td>
      </tr>\n";


#
# NS file upload.
# 
echo "<tr>
          <td>*Your NS file (20K max):</td>
          <td><input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"20000\">
94
              <input type=\"file\" name=\"exp_nsfile\" size=\"30\">
Leigh B. Stoller's avatar
Leigh B. Stoller committed
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 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139
              </td>
      </tr>\n";


#
# Expires, Starts, Ends. Also the hidden Created field.
#
$utime     = time();
$year      = date("Y", $utime);
$month     = date("m", $utime);
$thismonth = $month++;
if ($month > 12) {
	$month -= 12;
	$month = "0".$month;
}
$rest = date("d H:i:s", $utime);

echo "<tr>
          <td>Expiration date:</td>
          <td><input type=\"text\" value=\"$year:$month:$rest\"
                     name=\"exp_expires\"></td>
     </tr>\n";

echo "<tr>
          <td>Experiment starts:</td>
          <td><input type=\"text\" value=\"$year:$thismonth:$rest\"
                     name=\"exp_start\"></td>
	  <td><input type=\"hidden\" value=\"$year:$thismonth:$rest\"
                     name=\"exp_created\"></td>
          
     </tr>\n";

echo "<tr>
	  <td>Experiment ends:</td>
          <td><input type=\"text\" value=\"$year:$month:$rest\"
                     name=\"exp_end\"></td>
     </tr>\n";
?>

<tr>
    <td align="center" colspan="2">
        <b><input type="submit" value="Submit"></b></td>
</tr>
</form>
</table>
140 141 142 143 144 145 146

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