File: C:/xampp/htdocs/deltaE/lcdParsingF.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Displayer Check</title>
</head>
<body class="oneColElsCtr">
<?php
$sum=260;
$check=1;
$dtime=time();
$dStr=substr($dtime,7,9)."-";
if ($_FILES["file"]["size"] > 20000)
{
if ($_FILES["file"]["error"] > 0)
{
echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
}
else
{
echo "Displayer Checking form! " . "<br />";
echo "Upload: " . $_FILES["file"]["name"] . "<br />";
$filename=$_FILES["file"]["name"];
//echo "Type: " . $_FILES["file"]["type"] . "<br />";
echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
// echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />";
if (file_exists("upload/x" .$_FILES["file"]["name"]))
{
echo $_FILES["file"]["name"] . " already exists. ". "<br />";
}
else
{
move_uploaded_file($_FILES["file"]["tmp_name"],
$_FILES["file"]["name"]);
echo $_FILES["file"]["name"] ." upload sucess! " . "<br />";
echo "Report start: " . "<br />";
// echo "Stored in: " . "upload/" . $_FILES["file"]["name"]. "<br />";
$filename=substr($_FILES["file"]["name"],0,-4);
$computername = "FRED-PC";
$ip = gethostbyname($computername);
echo $ip."<br />";
exec("echo . | icclu -ff -ia -pl -s 255 " .$_FILES["file"]["name"]." <Vi24.txt> ".$filename.".txt");
//exec("ping ".$ip." -n 1 -w 90 && exit", $output);
//print_r($output);
///parsing start
$contents = file($filename.".txt");
$string = implode($contents);
//echo $contents[20];
//echo $string;
$p = ereg_replace("\r\n?", "\n", $string);
$p = str_replace("\n", ' ', $p);
//echo $p;
$dot = explode(" ", $p);
//echo $dot[0];
$myFile = "targetlab.txt";
$fh = fopen($myFile, 'w') or die("can't open file");
for ( $j = 0; $j <= 23; $j+= 1) {
for ( $i = 7; $i <= 9; $i += 1) {
$stringData = $dot[$i+($j*11)]."\n";
fwrite($fh, $stringData);
}
//fwrite($fh, "\r");
}
fclose($fh);
exec("dispreadAu.exe") ;
}//satrt parsing
}//upload sucess
}//upload check ok
else
{
echo "Invalid file";
}
?>
</table>
<tr>
<br />
<td align="center"><font size="-2"> © <a href="mailto:[email protected]">Fred Kuo</a>, 2010. All rights reserved.<br><a href="http://www.fredkuo.idv.tw/wordpress/?p=1025">Read more.</a><br>
</td>
</tr>
</body>
</html>