beginexp_form.php3 3.32 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.
#
Leigh B. Stoller's avatar
Leigh B. Stoller committed
12 13
$uid = "";
if ( ereg("php3\?([[:alnum:]]+)",$REQUEST_URI,$Vals) ) {
Leigh B. Stoller's avatar
Leigh B. Stoller committed
14 15
    $uid=$Vals[1];
    addslashes($uid);
Leigh B. Stoller's avatar
Leigh B. Stoller committed
16
} else {
Leigh B. Stoller's avatar
Leigh B. Stoller committed
17
    unset($uid);
Leigh B. Stoller's avatar
Leigh B. Stoller committed
18
}
Leigh B. Stoller's avatar
Leigh B. Stoller committed
19
LOGGEDINORDIE($uid);
Leigh B. Stoller's avatar
Leigh B. Stoller committed
20 21 22 23 24

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

?>
<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)) {
68
                  $project = $row[pid];
Leigh B. Stoller's avatar
Leigh B. Stoller committed
69 70 71 72 73 74 75 76 77
                  echo "<option value=\"$project\">$project</option>\n";
               }
echo "       </select>";
echo "    </td>
      </tr>\n";

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

echo "<tr>
88 89
          <td>*Long Name:</td>
          <td><input type=\"text\" name=\"exp_name\" size=\"40\">
Leigh B. Stoller's avatar
Leigh B. Stoller committed
90 91 92 93 94 95 96 97 98 99
              </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\">
100
              <input type=\"file\" name=\"exp_nsfile\" size=\"30\">
Leigh B. Stoller's avatar
Leigh B. Stoller committed
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 140 141 142 143 144 145
              </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>
146 147 148 149 150 151 152

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