File "index.php"
Full path: /www/ansys/ttest/accmes/index.php
File size: 3.99 KiB (4090 bytes)
MIME-type: text/x-php
Charset: utf-8
<?php
print "<html>";
print "<head>";
print "<meta http-equiv=\"content-type\" content=\"text/html;charset=utf-8\">";
print "<link rel=\"stylesheet\" type=\"text/css\" href=\"./css/style.css\">";
print "<link rel=\"shortcut icon\" href=\"/ansys/config/favicon.ico\">";
print "<title>加速度計測実験</title>";
print "</head>";
print "<body>";
try
{
$defaultPosition = "www,ansys,ttest,accmes,data";
$dataViewScript = "/ansys/ttest/accmes/graph.php";
$position = isset($_POST["position"]) ? htmlspecialchars($_POST["position"]) : "";
if (strcmp($position, "") == 0)
$position = $defaultPosition;
$returnPosition = "";
$positions = explode(",", $position);
$path = "";
$num = count($positions);
for($iCount = 0; $iCount < $num; $iCount++)
{
$path .= "/";
$path .= $positions[$iCount];
if ($iCount < $num - 1)
{
if ($iCount > 0)
$returnPosition .= ",";
$returnPosition .= $positions[$iCount];
}
}
print "<table width=\"45%\" border=\"0\" bgcolor=\"#000000\" cellspacing=\"0\" cellpadding=\"0\">";
print "<tr>";
print "<td>";
print "<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"3\">";
print "<tr bgcolor=\"#99CCFF\" align=\"center\">";
print "<th style=\"width:50%;\">";
print "File";
print "</th>";
print "<th style=\"width:20%;\">";
print "サイズ";
print "</th>";
print "<th style=\"width:30%;\">";
print "最終更新";
print "</th>";
print "</tr>";
$counter = 0;
if (strlen($returnPosition) >= strlen($defaultPosition))
{
print "<tr bgcolor=\"#FFFFFF\">";
print "<td align=\"left\">";
print "<form name=\"form_". $counter. "\" method=\"post\" action=\"". $_SERVER['PHP_SELF']. "\" style=\"display:inline\">";
print "<a href=\"javascript:form_". $counter. ".submit()\">". "一つ上のディレクトリへ戻る". "</a>";
print "<input type=\"hidden\" name=\"position\" value=\"". $returnPosition. "\">";
print "</form>";
print "</td>";
print "<td align=\"center\"> </td>";
print "<td align=\"center\"> </td>";
print "</tr>";
$counter++;
}
$files = array();
if ($dir = opendir($path))
{
while (($file = readdir($dir)) !== false)
{
if(($file != ".") && ($file != ".."))
{
$files[] = $file;
}
}
closedir($dir);
}
arsort($files);
//$numberOfFiles = count($files);
//for($iCount = 0; $iCount < $numberOfFiles; $iCount++)
foreach ($files as $key => $val)
{
$fullpath = $path. "/". $val;
print "<tr bgcolor=\"#FFFFFF\">";
print "<td align=\"left\">";
if (is_file($fullpath))
{
$extension = substr($val, strrpos($val, '.') + 1);
if (strcmp($extension, "txt") == 0)
{
print "<form name=\"form_". $counter. "\" method=\"post\" action=\"". $dataViewScript. "\" style=\"display:inline\">";
print "<a href=\"javascript:form_". $counter. ".submit()\">". $val. "</a>";
print "<input type=\"hidden\" name=\"position\" value=\"". $position. ",". $val. "\">";
print "</form>";
print "<br />";
}
else
{
print $val. "<br />";
}
}
else
{
print "<form name=\"form_". $counter. "\" method=\"post\" action=\"". $_SERVER['PHP_SELF']. "\" style=\"display:inline\">";
print "<a href=\"javascript:form_". $counter. ".submit()\">". $val. "</a>";
print "<input type=\"hidden\" name=\"position\" value=\"". $position. ",". $val. "\">";
print "</form>";
print "<br />";
}
print "</td>";
print "<td align=\"center\">";
print filesize($fullpath);
print "</td>";
print "<td align=\"center\">";
print date("Y-m-d H:i:s", filemtime($fullpath));
print "</td>";
print "</tr>";
$counter++;
}
print "</table>";
print "</td>";
print "</tr>";
print "</table>";
}
catch(Exception $exc)
{
print "<font color=\"#FF0000\">";
print "【スクリプトエラー】<br />";
print $exc->getMessage(). "<br />";
print "</font>";
}
print "<form name=\"form_return\" method=\"post\" action=\"". $_SERVER['PHP_SELF']. "\" style=\"display:inline\">";
print "<a href=\"javascript:form_return.submit()\">戻る</a>";
print "</form>";
print "<br />";
print "</body>";
print "</html>";