
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML lang="ja">
<META http-equiv='Conten-Language' content='ja'>
<META http-equiv='Conten-Type' content='text/html; charset=UTF-8'>

<HEAD>
<TITLE> </TITLE>
</HEAD>

<BODY>

<P>
<?php
	
	function valueAtIndexOf($ln, $col){
		$array = explode('","', $ln);
		if (count($array) >= $col){
			return $array[$col];
		} else
			return "";
	}
	
	$path = $_FILES['filename']['tmp_name'];
	if (is_uploaded_file($path)){
		echo "<p> $path </p>";
		if (file_exists($path)){
			if ($handle = fopen($path, 'r')) {
				// オープンしたファイルを読込む
				if ($handle) {
					echo "<table>";
					echo "<tr bgcolor='#3c9'>";
					echo "<td>code</td>";  // code
					echo "<td>classCode</td>";  // classCode
					echo "<td>requestCode</td>";  // requestCode
					echo "<td>name</td>";  // name
					echo "<td>point</td>";  // point
					echo "<td>unitName</td>";  // unitName
					echo "<td>handanCode</td>";  // point
					echo "<td>effectCode</td>";  // point
					echo "<td>dragEnforceDate</td>";
					echo "<td>actionEnforceDate</td>";
					echo "</tr>";
					$count=0;
					while (!feof($handle)) {
						$buff = fgets($handle);
						$buff = mb_convert_encoding($buff, "UTF-8", "UTF-8,SJIS,EUC-JP");
						
						//	echo "$buff<br/>";
						echo "<tr>";
						$array = explode('","', $buff);
						echo "<td>".$array[14]."</td>";  // code
						echo "<td>".$array[27]."</td>";  // classCode
						echo "<td>".$array[2]."</td>";  // requestCode
						echo "<td>".$array[4]."</td>";  // name
						echo "<td>".$array[11]."</td>";  // point
						echo "<td>".$array[9]."</td>";  // unitName
						echo "<td>".$array[50]."</td>";  // handanCode
						echo "<td>".$array[31]."</td>";  // effectCode
						echo "<td>".$array[29]."</td>";  // enforceDate
						echo "<td>".$array[86]."</td>";  // enforceDate
						echo "</tr>";
						$count++;
					}
					echo "<tr bgcolor='#3c9'>";
					echo "<td colspan=9>count: $count</td>";
					echo "</tr>";
					echo "</table>";
				}
				fclose($handle);
			} else
				echo "ERROR *** ($path) Cannot open \n";
		} else
			echo "ERROR *** ($path) not exist \n";
	} else {
		echo "ERROR *** ($path) を upload できませんでした \n";
	}
	
		
?>

</P>

</BODY>

</HTML>
