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/FograCT1/pbnEM6.php
<?php
session_start();
?>
<?php
$company= $_GET['company'];
if ($company=='')  {
	$company='pbndemo';
}

echo "Welcome!  ".$company;

 function getIP() {
      foreach (array('HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP', 'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR') as $key) {
         if (array_key_exists($key, $_SERVER) === true) {
            foreach (explode(',', $_SERVER[$key]) as $ip) {
               if (filter_var($ip, FILTER_VALIDATE_IP) !== false) {
                  return $ip;
               }
            }
         }
      }
   }
  // $tags=json_decode(file_get_contents('http://gd.geobytes.com/GetCityDetails?fqcn='. getIP()), true)
   //print_r($tags[geobytescity]);
   echo "ip:".getIP();
   $ip=getIP();
   $details = json_decode(file_get_contents("http://ipinfo.io/{$ip}/json"));
//echo $details->city; // -> "Mountain View"
//echo $details->country;
$myip=$ip;
$areaP=$details->city;
$country=$details->country;
echo "<br>area:".$areaP;
include '../CTCounter2.php';

 $servername = "127.0.0.1";
$username = "root";
$password = "fredsql";
$DBNAME = "tvicheck-st";


// Create connection
$conn = new mysqli($servername, $username, $password);

// Check connection
if ($conn->connect_error) {
  die("Connection failed: " . $conn->connect_error);
}
//echo "Connected successfully";


if( !mysqli_select_db($conn, $DBNAME)) {
  die ("無法選擇資料庫");
}
mysqli_query( $conn, "SET NAMES 'utf8'");


		
		$queryC="select * from ctmember where  company='$company' ";
		//echo "<br>".$queryC."<br>";
 		//$resultC = mysql_query($queryC) or die ("Error in query: $queryC. " . mysql_error());
	$results =  mysqli_query($conn, $queryC);
		$num = mysqli_num_rows( $results);
		//$obj = mysqli_fetch_object($results);
		
	if ($num > 0)
	{
		
$row = mysqli_fetch_object($results);	
$CTcount=$row->CTcount;

echo "count:".$CTcount;
$CTcount=$CTcount+1;

		$queryU="update ctmember set ldate=NOW(),ltool='DP6',CTcount='$CTcount' where company='$company' ";
		
		//$resultU = mysql_query($queryU) or die ("Error in query: $queryU. " . mysql_error());
$resultU = mysqli_query($conn, $queryU);
	}



?>



<!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
//error_reporting(0);
include 'de00.php';
//$tvifile= $_GET['tvifile'];
$f321= $_GET['f321'];
$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];
	  
	  
$name= $_GET['name'];
$company= $_GET['company'];
$device= $_GET['device'];
$instrument= $_GET['instrument'];
$display= $_GET['display'];
$target=$_GET['target'];
$devid=$_GET['devid'];

////////////////////////////////////////////////////db section



/////////////////////////////////////////////////////////////////

?>


  <?php

$sRx=0.64;$sRy=0.33;
$sGx=0.3;$sGy=0.6;
$sBx=0.15;$sBy=0.06;

$aRx=0.64;$aRy=0.33;
$aGx=0.21;$aGy=0.71;
$aBx=0.15;$aBy=0.06;

$pRx=0.68;$pRy=0.32;
$pGx=0.265;$pGy=0.69;
$pBx=0.15;$pBy=0.06;





$sum=200;
$check=1;
$dtime=time();
$dStr=substr($dtime,7,9)."-";
$myip = $_SERVER['REMOTE_ADDR'];


	   echo "Report start: " .  "<br />";

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

$dot = explode("_", $p);
//print_r($dot);
$sn=$dot[41];

ctcounter($company,$myip,$areaP,$country,$sn,'DP6');

$spRx=$dot[3];$spRy=$dot[4];
$spGx=$dot[10];$spGy=$dot[11];
$spBx=$dot[17];$spBy=$dot[18];


$I8=$dot[3]*($dot[11]- $dot[18])+$dot[10]*($dot[18]-$dot[4])+$dot[17]*($dot[4]-$dot[11]);
$area=round(0.5*ABS($I8),4);

$norm127=(($dot[29]-$dot[36])/($dot[22]-$dot[36]))*100;
$gamma=round(log($norm127*0.01,0.5),3);

$X1=$dot[0];$Y1=$dot[1];$Z1=$dot[2];
$measureL=$dot[3];$measurea=$dot[4];$measureb=$dot[5];

$CCT=$dot[26];
$cdm2=$dot[22];

if ($spGx<0.25) {
	$type="AdobeRGB";
}
elseif ($spGy>0.65) {
	$type="P3";
}
else  {
	$type="sRGB";
}

?>
<table width="400" border="1" align="center">
<tr align='center'>
<td align='center'>NO.</td><td>Rx</td><td>Ry</td><td>Gx</td><td>Gy</td><td>Bx</td><td>By</td><td>Area</td><td>Gamma</td><td>CCT</td><td>cdm2</td><td>type</td>
</tr><tr>

<td bgcolor='green' align='center'>sRGB</td><td><?php echo $sRx;?></td><td><?php echo $sRy;?></td><td><?php echo $sGx;?></td><td><?php echo $sGy;?></td><td><?php echo $sBx;?></td><td><?php echo $sBy;?></td><td>0.1121</td><td>2.2</td><td>6500</td>
</tr><tr>
<td bgcolor='red' align='center'>AdobeRGB</td><td><?php echo $aRx;?></td><td><?php echo $aRy;?></td><td><?php echo $aGx;?></td><td><?php echo $aGy;?></td><td><?php echo $aBx;?></td><td><?php echo $aBy;?></td><td>0.1511</td><td>2.2</td><td>6500</td>
</tr><tr>
<td bgcolor='blue' align='center'>P3(Display)</td><td><?php echo $pRx;?></td><td><?php echo $pRy;?></td><td><?php echo $pGx;?></td><td><?php echo $pGy;?></td><td><?php echo $pBx;?></td><td><?php echo $pBy;?></td><td>0.152</td><td>2.2</td><td>6500</td>
</tr><tr>

<td bgcolor='purple' align='center'>sample</td><td><?php echo round($dot[3],3);?></td><td><?php echo round($dot[4],3);?></td><td><?php echo round($dot[10],3);?></td><td><?php echo round($dot[11],3);?></td><td><?php echo round($dot[17],3);?></td><td><?php echo round($dot[18],3);?></td><td><?php echo $area;?></td><td><?php echo $gamma;?></td><td><?php echo $dot[26];?></td><td><?php echo round($dot[22],2);?></td><td><?php echo $type;?></td>
</tr>


</table>


<?php



 $servername = "127.0.0.1";
$username = "root";
$password = "fredsql";
$DBNAME = "tvicheck-st";

$conn = new mysqli($servername, $username, $password);

// Check connection
if ($conn->connect_error) {
  die("Connection failed: " . $conn->connect_error);
}
//echo "Connected successfully";


if( !mysqli_select_db($conn, $DBNAME)) {
  die ("無法選擇資料庫");
}
mysqli_query( $conn, "SET NAMES 'utf8'");


				$querys = "select area, filename  from dp6 where po='$po' ORDER BY id DESC LIMIT 1 ";
		//echo "sql:".$querys;
	$results =  mysqli_query($conn, $querys);
		$num = mysqli_num_rows( $results);
		//$obj = mysqli_fetch_object($results);
		
	if ($num > 0)
	{
		
$row = mysqli_fetch_object($results);	
		$sqName=$row->filename;
		$areaq=$row->area;}
	else {	$sNo=1;}
//echo "areaq:".$sqName;
	if ($sqName<>$filedb) {

		// generate and execute query
		$query = "INSERT INTO dp6(company, contact, ip, email, typee, filename, po, sn, Rx, Ry, Gx, Gy, Bx, Byy, area, cdm2, gamma, CCT, date) VALUES('$company', '$name', '$myip','$email', '$type', '$filedb','$po','$sn','$spRx','$spRy','$spGx','$spGy','$spBx','$spBy','$area', '$cdm2','$gamma', '$CCT',NOW())";
		//echo $query;
		$result = mysqli_query($conn, $query);
	}
		mysqli_close($conn);


		

		
?> 

<table width="200" border="1" align="center">
<tr>
<td><div align="center">
<?php // content="text/plain; charset=utf-8"

require_once ('../jpgraph/jpgraph.php');
require_once ('../jpgraph/jpgraph_scatter.php');

//unlink('targetrgb.ti3');
unlink('scatterGu.png');
//unlink('scatterGuF.png');
//unlink('scatterGuA.png');

$datax = array($sRx,$sGx,$sBx,$sRx);//Fogra39
$datay = array($sRy,$sGy,$sBy,$sRy);


$datax2 = array($aRx,$aGx,$aBx,$aRx);
$datay2 = array($aRy,$aGy,$aBy,$aRy);

$datax3 = array($pRx,$pGx,$pBx,$pRx);
$datay3 = array($pRy,$pGy,$pBy,$pRy);

$datax4 = array($spRx,$spGx,$spBx,$spRx);
$datay4 = array($spRy,$spGy,$spBy,$spRy);
//$datay2 = array(-48.6142,-50.4407, -3.16827,55.7002,93.9094,30.8941,-48.6142);

//Array ( [0] => -48.6142 [1] => -50.4407 [2] => -3.16827 [3] => 55.7002 [4] => 93.9094 [5] => 30.8941 [6] => -48.6142 )




$graph = new Graph(600,600);
$graph->img->SetMargin(40,40,40,40);	
$graph->img->SetAntiAliasing();
$graph->SetScale("linlin");
$graph->SetShadow();
$graph->title->Set("sample in Purple"); 
$graph->title->SetFont(FF_FONT1,FS_BOLD);
$graph->SetBackgroundImage("lab.png",BGIMG_FILLFRAME);

//$sp1->SetColor("#55bbdd");
//$sp1->SetLegend('Line 1');
$sp1 = new ScatterPlot($datay,$datax);
$sp1->SetLinkPoints(true,"green",2);
$sp1->mark->SetType(MARK_FILLEDCIRCLE);
$sp1->mark->SetFillColor("green");
$sp1->mark->SetWidth(3);

$sp3 = new ScatterPlot($datay3,$datax3);
$sp3->SetLinkPoints(true,"blue",2);
$sp3->mark->SetType(MARK_FILLEDCIRCLE);
$sp3->mark->SetFillColor("blue");
$sp3->mark->SetWidth(3);


$sp2 = new ScatterPlot($datay2,$datax2);
$sp2->SetLinkPoints(true,"red",2);
$sp2->mark->SetType(MARK_FILLEDCIRCLE);
$sp2->mark->SetFillColor("red");
$sp2->mark->SetWidth(3);
//print_r($datay3);
//print_r($datay2);
$sp4 = new ScatterPlot($datay4,$datax4);
$sp4->SetLinkPoints(true,"#A800DF",2);
$sp4->mark->SetType(MARK_FILLEDCIRCLE);
$sp4->mark->SetFillColor("#A800DF");
$sp4->mark->SetWidth(3);


$graph->Add($sp1);
$graph->Add($sp2);
$graph->Add($sp3);
$graph->Add($sp4);

//$graph->Stroke();

$graph->Stroke('scatterGu.png');



?>
<img src="scatterGu.png">
</div></td></tr>
</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>