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/PSATR16/toSCCA6.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();

$host="127.0.0.1";
$user="root";
$pass="fredsql";
$db="tvicheck-st";

$connection = mysql_connect($host, $user, $pass) or die ("Unable to connect!");
mysql_query("SET NAMES 'utf8'");
//$link = mssql_connect("MACBOOK7", "sa", "fred5697");
mysql_select_db($db) or die ("Unable to select database!");
$query = "select id from SCCA6 order by id desc  limit 0,1";
$result = mysql_query($query) or die ("Error in query: $query. " . mysql_error());

	while($row = mysql_fetch_object($result))
	{
$dStr=$row->id+1;
}


	$computername = "FRED-PC";
    $ip = gethostbyname($computername);
	echo $ip."<br />";

	  $contents = file("CRPC6.txt");
		$string = implode($contents);
		//echo $contents[20]; 
		//echo $string; 
$p = ereg_replace("\r\n?", "\n", $string);
$p = str_replace("\n", '	', $p);
//echo $p;

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;
}

$datastring=get_between($p,"BEGIN_DATA","END_DATA");
//echo $datastring;
$dot = explode("	", $datastring);
echo $dot[1268*8+6]."xx".$dot[1268*8+7];
$P6L=95;
$P6a=1;
$P6b=-4;

$PL=$L;
$Pa=$a;
$Pb=$b;

include 'lab2xyz.php';

include 'SCCA06.php';

include 'xyz2lab.php';

$Xp=lab2xyz("x",$PL,$Pa,$Pb);
$Yp=lab2xyz("y",$PL,$Pa,$Pb);
$Zp=lab2xyz("z",$PL,$Pa,$Pb);


$myFile =$dStr."-CRPC6toSCCA.txt";
//$icclab="upload/".$filename."T.ti1";
$fh = fopen($myFile, 'w') or die("can't open file");
//fwrite($fh, $p);


$viHead='ORIGINATOR "CGATS"							
FILE_DESCRIPTOR "CGATS21-2-CRPC6"							
# Characterized Reference Printing Condition 6, Universal Premium Coated							
CREATED "December, 2012"							
MEASUREMENT_GEOMETRY "ISO 13655 - Reflection, M1, white backing"							
FILTER "D50"							
# Reference White Point (LAB) = '. $PL . " " .$Pa. " ".$Pb.'							
# Reference Black Point (LAB) = 9.05  0.20  0.39							
NUMBER_OF_FIELDS 8							
BEGIN_DATA_FORMAT							
SAMPLE_ID CMYK_C CMYK_M CMYK_Y CMYK_K LAB_L LAB_A LAB_B							
END_DATA_FORMAT							
NUMBER_OF_SETS 1617							
BEGIN_DATA							
'; 


fwrite($fh, $viHead);

$data1="1	0	0	0	0	".$PL."	".$Pa."	".$Pb."
";
fwrite($fh, $data1);

for ( $i = 0; $i <= 1615; $i+= 1) {

$line=$i+2 ."	";
fwrite($fh, $line);
  // echo $dot[0]."x_";
	  $DataC =  $dot[$line*8+1]."	";
	  $DataM =  $dot[$line*8+2]."	";
	  $DataY =  $dot[$line*8+3]."	";
	  $DataK =  $dot[$line*8+4]."	";
	  $DataL =  $dot[$line*8+5]."	";
	  $Dataa =  $dot[$line*8+6]."	";
	  $Datab =  $dot[$line*8+7]."	";
	  
	  $X=lab2xyz("x",$DataL,$Dataa,$Datab);
	  $Y=lab2xyz("y",$DataL,$Dataa,$Datab);
	  $Z=lab2xyz("z",$DataL,$Dataa,$Datab);
	  
	  $scX=SCCA06("x",$X,$Xp);
	  $scY=SCCA06("y",$Y,$Yp);
	  $scZ=SCCA06("z",$Z,$Zp);

	  $scL=round(xyz2lab("l",$scX,$scY,$scZ),2)."	";
	  $sca=round(xyz2lab("a",$scX,$scY,$scZ),2)."	";
	  $scb=round(xyz2lab("b",$scX,$scY,$scZ),2);
	  

	$stringData = $DataC.$DataM.$DataY.$DataK.$scL.$sca.$scb;
		fwrite($fh, $stringData);
	  fwrite($fh, "
");
	  }
	  

$viTail='END_DATA';
fwrite($fh, $viTail);	  
fclose($fh);
$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!");

		// generate and execute query
		$query = "INSERT INTO SCCA6(company, contact, email, type, filename, score, passbit, date, device, dsn,  rankbit) VALUES('$company', '$contact', '$email',  '$type', '$filename','$Rsum', '$passbit', NOW(), '$device', '$dsn',  '$rankbit')";
		$result = mysql_query($query) or die ("Error in query: $query. " . mysql_error());
  
		mysql_close($connection);
?> 

	<SCRIPT LANGUAGE="JavaScript">
<!-- http://www.culturemark.com/redirectURL/
var spge = '<?php echo json_encode($dStr) ;?>';
window.location="remoteEX.php?id=".concat(spge);
// -->
</script> 


</table>

<tr>

<br />
<td align="center"><font size="-2"> &copy; <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>