File "list.php"

Full path: /www/ttest/acceleration/list.php
File size: 1.71 KiB (1754 bytes)
MIME-type: text/x-php
Charset: utf-8

Download   Open   Back

<?php
function html($tabs, $print)
{
	for($i = 0; $i < $tabs; $i++)
		print "\t";
	print $print. "\n";
}

function getFileList($target)
{
	$ret = array();
	$files = scandir($target);
	foreach($files as $file)
	{
		if (strcmp($file, ".") == 0 || strcmp($file, "..") == 0)
			continue;
		else if (is_file($target. "/". $file))
			$ret[] = $file;
	}
	return $ret;
}

$target = "./log/";

$files = getFileList($target);


html(0, "<!DOCTYPE html>");
html(0, "<html>");

// head
html(1, "<head>");
html(2, "<meta http-equiv=\"content-type\" content=\"text/html;charset=utf-8\">");
html(2, "<link rel=\"shortcut icon\" href=\"/ansys/config/favicon.ico\">");
html(2, "<title>加速度ログデータ一覧</title>");
html(1, "</head>");

// body
html(1, "<body>");

// header
html(2, "<center>");
html(3, "<font size=\"3\">");
html(4, "<b>加速度ログデータ一覧</b><br>");
html(4, "<b>【五洋建設株式会社】</b><br>");
html(3, "</font>");
html(2, "</center>");
html(2, "<hr>");

html(2, "<table border=\"1\" style=\"width:30%;\">");
html(3, "<tr bgcolor=\"#FF9999\">");
html(4, "<th style=\"width:70%;\">ファイル名</th>");
html(4, "<th>最終更新</th>");
html(3, "</tr>");
$bgc = "#FFFFFF";
for($i = 0; $i < count($files); $i++)
{
	html(3, "<tr bgcolor=\"". $bgc. "\">");
	html(4, "<td><a href=\"./log/". $files[$i]. "\">". $files[$i]. "</a></td>");
	html(4, "<td align=\"center\">". date("Y-m-d H:i:s", filemtime("./log/". $files[$i])). "</td>");
	html(3, "</tr>");
}
html(2, "</table>");

// footer
html(2, "<hr>");
html(2, "<center>");
html(3, "<font size=\"3\" color=\"#000000\" face=\"Arial\">");
html(4, "<b><i>penta-ocean</i></b>");
html(3, "</font>");
html(2, "</center>");

// html end
html(1, "</body>");
html(0, "</html>");
?>

PHP File Manager