Experiment ". "$pid/". "$eid\n"; echo "

A Linktest is already running; click to stop it!


\n"; echo "
"; echo "\n"; echo "\n"; echo "\n"; echo "
\n"; echo "
\n"; PAGEFOOTER(); return; } # # See if a level came in. If not, then get the default from the DB. # if (!isset($level) || $level == "") { $level = $linktest_level; } elseif (! TBvalid_tinyint($level) || $level < 0 || $level > TBDB_LINKTEST_MAX) { PAGEARGERROR("Linktest level must be an integer 0 <= level <= ". TBDB_LINKTEST_MAX); } # # If user hits stop button in the output side, stop linktest. # $fp = 0; function SPEWCLEANUP() { global $fp; if (connection_aborted() && $fp) { SUEXEC($uid, $unix_gid, "weblinktest -k $pid $eid", SUEXEC_ACTION_IGNORE); pclose($fp); exit(); } } # # Respond to the frame requests that are set up below. # if (isset($frame)) { if ($frame == "stopbutton") { if (isset($submit) && $submit == "Stop") { SUEXEC($uid, $unix_gid, "weblinktest -k $pid $eid", SUEXEC_ACTION_IGNORE); echo "
Linktest is shutting down
\n"; return; } # # Throw up a simple form to stop the linktest run. # echo "
Click to stop linktest run
\n"; echo " \n"; echo " \n"; echo " \n"; echo "\n"; echo "
\n"; return; } # Else must be the content side. register_shutdown_function("SPEWCLEANUP"); ignore_user_abort(1); set_time_limit(0); $fp = popen("$TBSUEXEC_PATH ". "$uid $unix_gid weblinktest -l $level $pid $eid", "r"); if (! $fp) { USERERROR("Linktest failed!", 1); } header("Content-Type: text/plain"); header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Cache-Control: no-cache, must-revalidate"); header("Pragma: no-cache"); flush(); for ($i = 0; $i < 1025; $i++) { echo " "; } echo "\n"; # See if we can get the browser to say something. echo date("D M d G:i:s T"); echo "\n"; echo "Starting linktest run at level $level\n"; flush(); while (!feof($fp)) { $string = fgets($fp, 1024); echo "$string"; flush(); } $retval = pclose($fp); $fp = 0; if ($retval == 0) echo "Linktest run was successful!\n"; echo date("D M d G:i:s T"); echo "\n"; return; } # # We run this twice. The first time we are checking for a confirmation # by putting up a form. The next time through the confirmation will be # set. Or, the user can hit the cancel button, in which case we should # probably redirect the browser back up a level. # if ($canceled) { PAGEHEADER("Run Linktest"); echo "


Operation canceled!

\n"; PAGEFOOTER(); return; } if (!$confirmed) { PAGEHEADER("Run Linktest at level $level"); echo "Experiment ". "$pid/". "$eid\n"; echo "

Are you REALLY sure you want to run linktest at level $level?


\n"; SHOWEXP($pid, $eid, 1); echo "
\n"; echo "
"; echo "\n"; echo "\n"; echo "\n"; echo "
Linktest Option: "; echo "

\n"; echo "\n"; echo "\n"; echo "
\n"; echo "
\n"; PAGEFOOTER(); return; } # # Throw up a simple frameset. # echo " Linktest for $pid/$eid \n"; echo " You must use a browser that can display frames to see this page. \n"; ?>