$WidthOfGraphic],expr],$maxmemory*1024*1024,\"Too Much RAM has been used so we are Aborting. This is currently limited to $maxmemory Mb in witm.php, but can be changed on the web server.\"],$maxtime,\"This is taking too long, so is being aborted. There is a limit of $maxtime seconds, which can only be changed by editing the PHP script on the web server - a user can't override this from their browser.\"]"); $handle = popen("echo $fullcmd | tee stdin.txt | $math | $sedcommand | tee stdout.txt", "r"); $data=fread($handle,10000); pclose($handle); } } /* The following is almost the same as the command above, but is modified a little for the mobile device. It prints smaller graphics and saves them to a different file name on mobile devices. */ if (isset($_POST['EvaluateMobile'])) { if ( $webserver === $demoURL) $data="Sorry, due to the license restrictions on Mathematica, I can't install a copy of that product here for all to use. So this demo of WITM on $demoSite does not function. If you installed WITM yourself, you would get text results in this text box and graphical ones, like the 3D graph, in the box below. I would appreciate feedback on WITM, even if you can only provide it from this demo."; else { $cmd=$_POST['input_data']; /* Undo the effect of the magic quote abomination */ if (get_magic_quotes_gpc()) { $cmd=stripslashes($cmd); } $fullcmd=escapeshellarg("TimeConstrained[MemoryConstrained[expr=$cmd;head=ToString[Head[expr]];If[head==ToString[Graphics] || head==ToString[SurfaceGraphics] || head==ToString[ContourGraphics] || head ==ToString[DensityGraphics] || head==ToString[GraphicsArray] || head==ToString[Graphics3D] ,Export[$handheld,expr,ImageSize->$WidthOfGraphicMobile],expr],$maxmemory*1024*1024,\"Too Much RAM has been used so we are Aborting. This is currently limited to $maxmemory Mb in witm.php, but can be changed on the web server.\"],$maxtime,\"This is taking too long, so is being aborted. There is a limit of $maxtime seconds, which can only be changed by editing the PHP script on the web server - a user can't override this from their browser.\"]"); $handle = popen("echo $fullcmd | tee stdin.txt | $math | $sedcommand | tee stdout.txt", "r"); $data=fread($handle,10000); pclose($handle); } } ?>