HEX
Server: Apache/2.4.46 (Win64) OpenSSL/1.1.1j PHP/8.4.25
System: Windows NT DESKTOP-4TAV2RJ 10.0 build 19045 (Windows 10) AMD64
User: fred (0)
PHP: 8.4.25
Disabled: NONE
Upload Files
File: C:/xampp/htdocs/cmykDe51/6pmmTVI-parsingCTOKX.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>Control-9 Check</title>
<style type="text/css">
<!--
body {
	font: 100% Verdana, Arial, Helvetica, sans-serif;
	background: #ffffff;
	margin: 0; /* 比較好的做法是將 Body 元素的邊界與欄位間隔調整為零,以處理不同的瀏覽器預設值 */
	padding: 0;
	text-align: center; /* 這樣會讓容器在 IE 5* 瀏覽器內置中對齊。然後,文字會在 #container 選取器中設定為靠左對齊預設值 */
	color: #000000;
}
.oneColElsCtr #container {
	width: 46em;
	background: #FFFFFF;
	margin: 0 auto; /* 自動邊界 (搭配寬度) 會讓頁面置中對齊 */
	border: 0px solid #000000;
	text-align: left; /* 這樣做會覆寫 Body 元素上的 text-align: center。 */
}
.oneColElsCtr #mainContent {
	padding: 0 20px; /* 請記住,欄位間隔就是 Div 方塊內部的空間,而邊界就是 Div 方塊外部的空間 */
}
-->
</style></head>

<body class="oneColElsCtr">
<?php
error_reporting(0);
$f123= $_GET['f123'];
$f321= $_GET['f321'];
$spl= $_GET['spl'];
$spa= $_GET['spa'];
$spb= $_GET['spb'];
$plC= $_GET['plC'];
$plM= $_GET['plM'];
$plY= $_GET['plY'];
$plK= $_GET['plK'];
$plS1= $_GET['plS1'];
$plS2= $_GET['plS2'];
$plS3= $_GET['plS3'];
$plS4= $_GET['plS4'];
$plS5= $_GET['plS5'];
$plS6= $_GET['plS6'];
$okName= $_GET['okName'];
$target=$_GET['aim'];

include 'spXYZ.php';
include 'sp38XYZ.php';
include 'lab2xyz.php';
include 'SCCA06.php';
include 'xyz2lab01.php';
include 'xyz2lab.php';
//include 'DensityV38.php';


$sum=120;
$check=1;
$dtime=time();
$dStr=substr($dtime,7,9)."-";


function get_between ($text, $s1, $s2) {
$mid_url = "";
$pos_s = strrpos($text,$s1);
$pos_e = strrpos($text,$s2);
for ( $i=$pos_s+strlen($s1) ; (( $i<($pos_e)) && $i < strlen($text)) ; $i++ ) {
$mid_url .= $text[$i];
}
return $mid_url;
}



	  $contentT = file($f321);
	  //echo substr('abcdef', 1, 3);  // bcd
	  $filedb=substr($f321,7,60);
	  $dbstr=explode("_", $filedb);
	  echo $dbstr[0]."XX".$dbstr[1]."XX".$dbstr[2]."XX".$dbstr[3].$dbstr[4].$dbstr[5];
	  $filename=$filedb;
	  $po=$dbstr[1];
		$stringC = implode($contentT);
		
		$fMark = strrpos($stringC,'i1Profiler');
		//echo "fMark:".$fMark."<br>";
		$fMarkC = strrpos($stringC,'ColorPort');
		//echo "fMarkC:".$fMarkC."<br>";

		$nm380 = strrpos($stringC,'nm380');
		echo "fMarkC:".$nm380."<br>";
		
		$stringT = implode($contentT);
		//echo $contents[20]; 
		//echo $string; 
$pt = ereg_replace("\r\n?", "	", $stringT);

$datastring=get_between($pt,"BEGIN_DATA","END_DATA");

$dotT = explode("	", $datastring);////Measure upload

//print_r ($dotT);
		


	  $contents = file($f123);
	  //echo substr('abcdef', 1, 3);  // bcd
	 // $filedb=substr($f123,7,45);
	 // $dbstr=explode("_", $filedb);
	  echo $dbstr[0]."XX".$dbstr[1]."XX".$dbstr[2]."XX".$dbstr[3];
		$string = implode($contents);
		//echo "dot[678]".$contents[6]; 
$string = implode($contents);		
$p = ereg_replace("\r\n?", "	", $string);
$datastring0=get_between($p,"BEGIN_DATA","END_DATA");

$dot = explode("	", $datastring0);////Tartget.txt

//print_r ($dot);

/////////////////////////////////////////
$input1 = "input1.txt";
//$icclab="upload/".$filename."T.ti1";
$fh = fopen($input1, 'w') or die("can't open file");
$viHead=$dot[7]." ".$dot[8]." ".$dot[9];
fwrite($fh, $viHead);
fclose($fh);
exec("echo . | icclu -fb -ip -pl -s 255 sRGB.icm <input1.txt> out1.txt");

$frgb1="out1.txt";
$stringr1 = file($frgb1);
$rgb1 = implode($stringr1);		
$dotR1 = explode(" ", $rgb1);
//echo "<br>R7:".round($dotR1[7],0);
//echo "<br>R8:".round($dotR1[8],0);
//echo "<br>R9:".round($dotR1[9],0);

$R1=round($dotR1[7],0);
$G1=round($dotR1[8],0);
$B1=round($dotR1[9],0);


/////////////////////////////////////////
$input2 = "input2.txt";
//$icclab="upload/".$filename."T.ti1";
$fh2 = fopen($input2, 'w') or die("can't open file");
$viHead2=$dotT[7]." ".$dotT[8]." ".$dotT[9];
fwrite($fh2, $viHead2);
fclose($fh2);
exec("echo . | icclu -fb -ip -pl -s 255 sRGB.icm <input2.txt> out2.txt");

$frgb2="out2.txt";
$stringr2 = file($frgb2);
$rgb2 = implode($stringr2);		
$dotR2 = explode(" ", $rgb2);
//echo "<br>R7:".round($dotR1[7],0);
//echo "<br>R8:".round($dotR1[8],0);
//echo "<br>R9:".round($dotR1[9],0);

$R2=round($dotR2[7],0);
$G2=round($dotR2[8],0);
$B2=round($dotR2[9],0);

function RGBToHex($r, $g, $b) {
//String padding bug found and the solution put forth by Pete Williams (http://snipplr.com/users/PeteW)
$hex = "#";
$hex.= str_pad(dechex($r), 2, "0", STR_PAD_LEFT);
$hex.= str_pad(dechex($g), 2, "0", STR_PAD_LEFT);
$hex.= str_pad(dechex($b), 2, "0", STR_PAD_LEFT);
 
return $hex;
}

$ch1C2=RGBToHex($R1,$G1,$B1);
//echo "<br>HEX:".$ch1C2;
$ch1C3=RGBToHex($R2,$G2,$B2);

function de76($l1,$a1,$b1,$l2,$a2,$b2) {
  $d76=sqrt(pow(($l1-$l2),2)+ pow(($a1-$a2),2)+pow(($b1-$b2),2));
  return round($d76,2);
}

$targetL=$dot[7];$targeta=$dot[8];$targetb=$dot[9];
$measureL=$dotT[7];$measurea=$dotT[8];$measureb=$dotT[9];
$de76=de76($targetL,$targeta,$targetb,$measureL,$measurea,$measureb);


  $connection = mysql_connect("127.0.0.1", "root", "fredsql") or die ("Unable to connect!");
	mysql_query("SET NAMES 'utf8'");
	$db = "tvicheck-st";
		// select database
		mysql_select_db($db) or die ("Unable to select database!");

		$querys = "select * from spotDe where job='$dbstr[1]' ORDER BY id DESC LIMIT 1 ";
		
		$results = mysql_query($querys) or die ("Error in query: $querys. " . mysql_error());
	
	if (mysql_num_rows($results) > 0)
	{
		$row = mysql_fetch_object($results);
		$sNo=$row->sNo+1;
		}
	else {	$sNo=1;}
		
		
		
		
		// generate and execute query
		$query = "INSERT INTO spotDe(job,sNo,target,TL, Ta, Tb, mL, ma, mb, de,ddate) VALUES('$dbstr[1]','$sNo','$target','$targetL', '$targeta', '$targetb', '$measureL', '$measurea','$measureb',  '$de76',NOW() )";
	
		//echo $query;
		$result = mysql_query($query) or die ("Error in query: $query. " . mysql_error());
  
		mysql_close($connection);

?>

<table width="300" border="1" align="center">
  <tr>
  	 <td bgcolor="<?php echo $ch1C2;?>"><?php echo "目標:</td><td>".$dot[7]."</td><td>".$dot[8]."</td><td>".$dot[9];?></td>
    </tr>
	
	 <tr>
  	 <td bgcolor="<?php echo $ch1C3;?>"><?php echo "量測:</td><td>".$dotT[7]."</td><td>".$dotT[8]."</td><td>".$dotT[9];?></td>
    </tr>
	
		 <tr>
  	 <td bgcolor="<?php echo $ch1C3;?>"><?php echo "色差:</td><td>".$de76."";?></td>
	 <td bgcolor="<?php echo $ch1C3;?>"><?php echo "id:</td><td>".$sNo."";?></td>
    </tr>
 </table>  
 
 <?php


?>
<br><br>
<tr>
<td align="center"><font size="-2"> &copy; <a href="mailto:[email protected]">Fred Kuo</a>, 2015. All rights reserved.<br><a href="http://www.fredkuo.idv.tw/wordpress/?p=1025">Read more.</a><br>
</td>
</tr>
</body>


</html>