Sindbad~EG File Manager
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- DW6 -->
<?php include ('include/head.php'); ?>
<body onmousemove="closesubnav(event);">
<?php include ('include/body.php');
echo "<div class=\"style1\" id=\"pageName\">
<h2>Examples<img alt=\"small logo\" src=\"logo.jpg\" height=\"59\" width=\"66\"/></h2><br><br>\n";
$directory = $_GET['directory'];
$showfile = $_GET['showfile'];
if ( !isset($directory) ) {
echo "<BR><BR><B>Select a category:</b><BR><ul>\n";
$d = dir("examples/");
while (false !== ($file = $d->read())) {
if ( $file == "." or $file == ".." ) continue;
if ( is_dir("examples/$file") ) {
echo "<li><a href='examples.php?directory=$file'>$file</a></li>\n";
}
}
echo "</ul>\n";
$d->close();
} else if ( !isset($showfile) and isset($directory) ) {
if ( !is_dir("examples/$directory") ) {
echo "Category $directory does not exist.<br>Please try again.<br>";
exit();
}
$DirectoryWithSpaces = $directory; // unCamelCase($directory);
echo "<center><b>$directoryWithSpaces</b></center><br><br>";
echo "<center><table border=1>
<th>Input File</th><th>Output File</th><th>The Proof</th><th>Commentary</th><th>Date</th>\n";
$d = dir("examples/$directory");
while (false !== ($file = $d->read())) {
if ( $file == "." or $file == ".." ) continue;
if ( strstr($file,".in") ) {
echo "<tr><td><a href='examples.php?directory=$directory&showfile=$file'>$file</a></td><td>";
$filename = substr($file,0,-3);
$prffile = $filename.".prf";
$dscfile = $filename.".html";
$outfile = $filename.".out";
$theDate = date("r",filemtime("examples/$directory/$file"));
if ( file_exists("examples/$directory/$outfile") ) {
echo "<a href='examples.php?directory=$directory&showfile=$outfile'>$outfile</a>";
}
echo "</td><td>";
if ( file_exists("examples/$directory/$prffile") ) {
echo "<a href='examples.php?directory=$directory&showfile=$prffile'>$prffile</a>";
}
echo "</td><td>";
if ( file_exists("examples/$directory/$dscfile") ) {
echo "<a href='examples.php?directory=$directory&showfile=$dscfile'>$dscfile</a>";
}
echo "</td><td>";
echo $theDate;
echo "</td></tr>\n";
}
}
$d->close();
echo "</table></center><p> </p>\n";
} else {
if ( file_exists("examples/$directory/$showfile") ) {
if ( strstr($showfile,".in") ) {
include ('include/functions.php');
$ItIsAnInput = 1;
} else
$ItIsAnInput = 0;
if ( strstr($showfile,".html") ) {
$ItIsAnHTML = 1;
} else
$ItIsAnHTML = 0;
echo "<b><center>Examples -> $directory -> $showfile</center></b><br><br>";
$fp = fopen("examples/$directory/$showfile", "rt", $use_include_path);
$content = "";
if ($fp) {
while ( !feof($fp) ) {
$line = fgets($fp,4096);
// if ( $ItIsAnInput == 1 )
// $content .= $line;
if($ItIsAnHTML)
echo $line;
else // for .prf, .in, and .out files
{ echo htmlspecialchars($line); // replaces quotes, < , etc. by HTML entities
echo "<br>";
}
}
fclose($fp);
if ( $ItIsAnInput == 1 ) {
echo "<hr><br>\n";
$infile = "examples/$directory/$showfile" ;
$outfile = "examples/$directory/" . substr($showfile, 0, strlen($showfile)-3) . ".out"; // strip off ".in" and replace with ".out"
echo "<form method=\"POST\" action=\"otter_simple3.php?infile=$infile&outfile=$outfile\" >" ;
// echo "<INPUT TYPE=\"HIDDEN\" NAME=\"OtterInput\" VALUE=\"$content\">" ;
echo "<center><input type=\"submit\" value=\"Run this example using Otter-λ\" name=\"B1\"></center>";
echo "</form>\n";
}
} else {
echo "ERROR: Could not open $showfile.<BR>";
}
} else {
echo "ERROR: $showfile does not exist.<BR>";
}
}
echo"</div>";
include ('include/footer.php'); ?>
</body>
</html>
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists