(1024 * 500)) { $errors["Local NS File"] = "Too big!"; } elseif ($_FILES['exp_nsfile']['name'] == "") { $errors["Local NS File"] = "Local filename does not appear to be valid"; } elseif ($_FILES['exp_nsfile']['tmp_name'] == "") { $errors["Local NS File"] = "Temp filename does not appear to be valid"; } elseif (!preg_match("/^([-\@\w\.\/]+)$/", $_FILES['exp_nsfile']['tmp_name'])) { $errors["Local NS File"] = "Temp path includes illegal characters"; } # # For the benefit of the form. Remember to pass back actual filename, not # the php temporary file name. Note that there appears to be some kind # of breakage, at least in opera; filename has no path. # $formfields['exp_nsfile'] = $_FILES['exp_nsfile']['name']; if (count($errors)) { SPITFORM($formfields, $errors); PAGEFOOTER(); exit(1); } # Read the entire file into a string. $file_contents = file_get_contents($_FILES['exp_nsfile']['tmp_name']); if (!$file_contents || $file_contents == "") { $errors["Local NS File"] = "Error reading file on server"; SPITFORM($formfields, $errors); PAGEFOOTER(); exit(1); } $formfields["exp_nsfile_contents"] = urlencode($file_contents); } $args = array(); $args[0] = $formfields; $xmlcode = xmlrpc_encode_request("dummy", $args); return $xmlcode; } # # Spit the form out using the array of data. # function SPITFORM($formfields, $errors) { global $TBDB_PIDLEN, $TBDB_GIDLEN, $TBDB_EIDLEN, $TBDOCBASE; global $view, $view_style, $projlist, $linktest_levels; global $EXPOSELINKTEST, $EXPOSEARCHIVE; global $EXPOSESTATESAVE; global $TBVALIDDIRS_HTML; PAGEHEADER("Begin a Testbed Experiment"); echo "\n"; if ($errors) { echo "\n"; while (list ($name, $message) = each ($errors)) { echo "\n"; } echo "
 Oops, please fix the following errors! 
$name:  $message

\n"; } else { if (! isset($formfields['copyid'])) { if (!isset($formfields['nsref']) && !isset($view['quiet'])) { echo "


"; } else { if (isset($view['plab_ns_message'])) { echo "

To finish creating your slice, edit the following information as needed, and click Submit. PlanetLab requires users to provide detail on what their slice will be doing via its description (i.e., what kind of network traffic it will be producing). Be sure to read over the PlanetLab AUP if you haven't already.

\n"; } else { echo "

Your automatically generated NS file has been " . "uploaded. To finish creating your experiment, " . "please fill out the following information:

"; } } } } echo "
\n"; # Something funky going on ... echo "\n"; echo "\n"; # # Include view_style in a hidden field so that it gets preserved if there # are errors # if ($view_style) { echo "\n"; } # # Select Project # if (isset($view['hide_proj']) && (count($projlist) == 1)) { # Just include the project as a hidden field - since the user has # only a single project, grab that project, which is the first thing # in $projlist list($project) = each($projlist); echo "\n"; } else { echo "\n"; } # # Select a group # if (isset($view['hide_group'])) { if (isset($formfields['group'])) { $group = $formfields['group']; } else { $group = ""; } echo "\n"; } else { echo "\n"; } # # Name: # echo "\n"; # # Description # if (isset($view["plab_descr"])) { echo "\n"; } else { echo "\n"; } # # NS file # if (isset($formfields['copyid'])) { $copyid = $formfields['copyid']; echo "\n"; } elseif (isset($formfields['nsref'])) { $nsref = $formfields['nsref']; if (isset($formfields['guid'])) { $guid = $formfields['guid']; echo "\n"; } else { echo "\n"; } } else { echo "\n"; } # # Swapping # # Add in hidden fields to send swappable and noswap_reason, since # they do not show on the form echo "\n"; echo "\n"; if (isset($view['hide_swap'])) { $idlevars = array('exp_idleswap','exp_noidleswap_reason', 'exp_idleswap_timeout', 'exp_autoswap','exp_autoswap_timeout'); while (list($index,$value) = each($idlevars)) { if (isset($formfields[$value])) { echo "\n"; } } } else { echo ""; } # # Run linktest, and level. # if (STUDLY() || $EXPOSELINKTEST) { if (isset($view['hide_linktest'])) { if ($formfields['exp_linktest']) { echo "\n"; } } # # Batch Experiment? # if (isset($view['hide_batch'])) { if ($formfields['exp_batched']) { echo "\n"; } # # Preload? # if (isset($view['hide_preload'])) { if ($formfields['exp_preload']) { echo "\n"; } } else { echo "\n"; } echo "
Select Project: "; echo "
Group: (Must be default or correspond to selected project)
Name:
(No blanks)
Slice Description:
(Please be detailed)
Description:
(A concise sentence)
Copy of experiment $copyid:   Click for NS File\n"; echo "
Your auto-generated NS file:   View NS File
Your auto-generated NS file:   View NS File
Your NS file:
Upload
(500k max)
  or
On Server
(" . $TBVALIDDIRS_HTML . ")
Swapping: "; if (STUDLY() || $EXPOSESTATESAVE) { echo "\n"; echo ""; } echo "
Idle-Swap: Swap out this experiment after hours idle.
If not, why not?
Max. Duration: Swap out after hours, even if not idle.
State Saving: Save disk state on swapout
Linktest Option: "; echo " (What is this?)"; echo "
\n"; echo "Batch Mode Experiment   (See Tutorial for more information)
\n"; echo "Do Not Swap In
\n"; if (!isset($view['quiet'])) { echo "

Handy Links:

\n"; } } ?>