if ($_POST["mode"] == "Run Code") { global $TempDirectory; echo '
Compiler errors are reported below'; echo '
';
$timestamp = date("y-m-d_H.i.s", time());
if (!is_dir("$TempDirectory/WebTrilinos")) mkdir("$TempDirectory/WebTrilinos");
$configFileName = "$TempDirectory/WebTrilinos/$timestamp.cpp";
$configFile = fopen($configFileName, 'w')
or die("can't open $configFileName: $php_errormsg");
if (-1 == fwrite($configFile, $_POST["code"])) {
die("can't write to $configFileName: $php_errormsg"); }
fclose($configFile)
or die("can't close $configFileName: $php_errormsg");
chmod($configFileName, 0664);
global $INCLUDES;
global $LDFLAGS;
global $LIBS;
global $CXX;
$command .= "$CXX $configFileName $INCLUDES $LDFLAGS $LIBS ";
$command .= "-DHAVE_CONFIG_H -o $TempDirectory/WebTrilinos/$timestamp.exe 2>&1";
passthru($command);
echo 'The output of the code is reported below.
'; echo '
'; $command = "cd $TempDirectory/WebTrilinos;"; $command.= "./$timestamp.exe 2>&1 "; passthru($command); echo '