File "dataview.php"

Full path: /www/ansys/qgis/012_kawasaki/ds/dataview.php
File size: 4.56 KiB (4666 bytes)
MIME-type: text/html
Charset: utf-8

Download   Open   Back

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 <html lang="ja">
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
 <meta http-equiv="Refresh" content="5">
 <title>DATAを表示</title>

</head>
<!--<body onLoad="resizeTo(768,1366);" >-->
<body>

 <?php

//■本日の台数
$limit=0;//初期値
$limitfilepath = "limit_count.txt";

//閾値データの取得
if (file_exists( $limitfilepath)) {

	$fp = fopen($limitfilepath, 'r');
	$line = fgets($fp);
	$limit=$line +0;
	fclose($fp);
}

//■現場名
$constfilepath = "const_name.txt";
//閾値データの取得
if (file_exists( $constfilepath)) {

	$fp2 = fopen($constfilepath, 'r');
	$const_name = "川崎港臨港道路東扇島水町線主橋脚部 " ."<BR>" ."(" .fgets($fp2) .")橋梁下部工事";
	fclose($fp2);
}


//範囲にいる端末をカウント

$HOST = "192.168.100.153";
$DB = "ansys";
$USER = "postgres";
$PASS = "am#71ZJ*";
$LOG_FILE = "./log/view.log";

$CONST_ID = 15;
$APPLICATION_ID = 26;
//================================================
//	データベース接続
//================================================
$conn = pg_connect("
	host	=	". $HOST. "
	dbname	=	". $DB. "
	user	=	". $USER. "
	password=	". $PASS. "
");
if (!$conn)
{
	throw new Exception("データベースへの接続に失敗しました");
}

$reg_time = date("Y-m-d H:i:s" ,time()-600);
//print $reg_time ."<BR>";
//----------■エリア1------------------------------

$AreaJudge = "SELECT * FROM qgis.ts_terminal WHERE const_id = 15 AND app_id = 26 AND upddatetime > '" .$reg_time  ."' AND " ;
$AreaJudge .= "point(lon*10000000,lat*10000000) @ polygon '(";

//本番環境
//$AreaJudge .= "(1397470796,354997240),";
$AreaJudge .= "(1397475150,354994530),";
$AreaJudge .= "(1397467325,355001957),";
$AreaJudge .= "(1397461872,354999315),";
//$AreaJudge .= "(1397465767,354994022)";
$AreaJudge .= "(1397467530,354991050)";

//1397475150,354994530
//1397467530,354991050


//35.49972,139.7470796
//35.49940,139.7465767



//本番環境2
/*
$AreaJudge .= "(1397468220,355003240),";
$AreaJudge .= "(1397460190,354999070),";
$AreaJudge .= "(1397455170,355006560),";
$AreaJudge .= "(1397462870,355010470)";
*/
//139.746822,35.500324
//139.746019,35.499907
//139.745517,35.500656
//139.746287,35.501047




//テスト1(入場不可)
//$AreaJudge .= "(1399352370,369074100),";
//$AreaJudge .= "(1399384770,369086630),";
//$AreaJudge .= "(1399394000,369075730),";
//$AreaJudge .= "(1399359020,369062350)";

//テスト1(入場可能)
//$AreaJudge .= "(1399352910,369074190),";
//$AreaJudge .= "(1399359130,369062440),";
//$AreaJudge .= "(1399374470,369082600),"; 
//$AreaJudge .= "(1399381340,369071700)";
$AreaJudge .= ")'";
$AreaJudge .= " ORDER BY terminal_name;";



//139.935237,36.907410
//139.938477,36.908663
//139.939400,36.907573
//139.935902,36.906235

//1399352910,369074190
//1399359130,369062440
//1399374470,369082600
//1399381340,369071700

//print $AreaJudge ."<BR>";

$ResPoint = pg_query($conn, $AreaJudge) or die("SQL ERROR!!<br />". $AreaJudge.pg_last_error());
$CountPoint = pg_num_rows($ResPoint);

//print $CountPoint;


for($i = 0;$i < $CountPoint;$i++)
{
	//print $i ."<BR>";
	$row = pg_fetch_array($ResPoint,$i);
//	print $row['terminal_name'] ;
//	print "<BR>";
}

//■入場の可否


if($limit > $CountPoint)
{
	$Message = "入場可能";
	$bg_color =  "#FFFFFF";
	$font_color = "#0000FF";
}
else
{
	$Message = "待機せよ";
	$bg_color =  "#FF0000";
	$font_color = "#FFFFFF";
}



  print "<div>";
  print "<TABLE BORDER='0' ALIGN='center' width='100%' height='100%'style='font-size: 120px;background-color:#FFFFFF;color:#00000;line-height:1'>";
  print "<TR ALIGN='left'><TD>";
  print "本日の制限<BR>台数<BR>";
  print "</TD></TR>";
  print "<TR ALIGN='center' style='font-size: 220px;'><TD>";
  print  $limit .'台';
  print "</TD>";
  print "</TR>";


  print "<TR ALIGN='left'><TD>";
  print "現在の入場<BR>台数<BR>";
  print "</TD></TR>";
  print "<TR ALIGN='center' style='font-size: 220px;'><TD>";
  print $CountPoint .'台';
  print "<BR>";
  print "</TD>";
  print "</TR>";


//  print "<TR ALIGN='center'><TD colspan='2' style='border-bottom-style: hidden;'>";
  print "<TR ALIGN='center'  style='font-size: 200px;background-color:".$bg_color .";color:" .$font_color .";'><TD colspan='2' style='border-bottom-style: hidden;'>";
  print $Message;
  print "</TD>";
  print "</TR>";


  print "<TR ALIGN='center' style='font-size: 14vmax;color:#000000;'><TD colspan='2'>";
 // print $const_name;
  print "<BR></TD>";
  print "</TR>";



  print "</TABLE>";
//出力
 print "</div>";
 ?>

 </body>
 </html>

PHP File Manager