TBDB_LINKTEST_MAX) { return "failed:Linktest level ($level) must be an integer ". "1 <= level <= ". TBDB_LINKTEST_MAX; } # For backend script call. TBGroupUnixInfo($pid, $gid, $unix_gid, $unix_name); # Make sure we shutdown if client goes away. register_shutdown_function("SPEWCLEANUP"); set_time_limit(0); # XXX Hackish! $linktest_running = 1; $fp = popen("$TBSUEXEC_PATH $uid $pid,$unix_gid ". "weblinktest -l $level $pid $eid", "r"); if (! $fp) { USERERROR("Could not start linktest!", 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"); echo "Starting linktest run at level $level on " . date("D M d G:i:s T"); # Oh, this is soooooo bogus! for ($i = 0; $i < 1024; $i++) { echo " "; } echo "\n"; flush(); while (!feof($fp)) { $string = fgets($fp, 1024); echo "$string"; flush(); } $retval = pclose($fp); $linktest_running = 0; if ($retval > 0) { echo "Linktest reported errors! Stopped at " . date("D M d G:i:s T") . "\n"; } elseif ($retval < 0) { echo $suexec_output; } else { # Success. echo "Linktest run was successful! Stopped at " . date("D M d G:i:s T") . "\n"; } exit(0); } # See if this request is to one of the above functions. Does not return # if it is. Otherwise return and continue on. sajax_handle_client_request(); # # In plain kill mode, just use the stop_linktest function and then # redirect back to the showexp page. # if (isset($kill) && $kill == 1) { stop_linktest(); header("Location: showexp.php3?pid=$pid&eid=$eid"); return; } if (isset($start) && isset($level)) { start_linktest($level); return; } # # Okay, this is the initial page. # PAGEHEADER("Run Linktest"); # Must do this! CHECKPAGEARGS(); GRABDBDATA(); echo "\n"; echo "Experiment ". "$pid/". "$eid\n"; echo "