File "end_check.php"
Full path: /www/ansys/qgis/common/end_check.php
File size: 3.3 KiB (3384 bytes)
MIME-type: text/x-php
Charset: utf-8
<?php
// アプリケーションの起動時にconst_id、app_id、android_idがPOSTされてくる
// 起動時間テーブルをUPDATE
// アプリのバージョンを取得
// 端末の名称を取得
// 「端末名称,アプリバージョン<\r>」を出力
//print "ミキサー2号車,1.0.0\n";
//-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
// 自動でクラスを参照する
// 関数名 : __autoload()
// 備考 : 参照先は./class/XXX.phpとする
// 更新 : 2012/11/29 KMK-Teraoka
//-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
function __autoload($className)
{
$fPath = "./class/" . str_replace("_", "/", $className) . ".php";
require_once $fPath;
}
//===============================================
// DEBUG_MODE
// 備考 :
// 更新 : 2012/11/29 KMK-Teraoka
//===============================================
define("DEBUG_MODE", "0");
Debug::setMode(DEBUG_MODE);
if (DEBUG_MODE == 1)
{
Stopwatch::start();
}
//===============================================
// CommonUtilities
// 備考 :
// 更新 : 2012/11/29 KMK-Teraoka
//===============================================
$HOST = "192.168.100.153";
$DB = "ansys";
$USER = "postgres";
$PASS = "am#71ZJ*";
$LOG_FILE = "./log/end_check.log";
try
{
$_log = new Log($LOG_FILE);
//===============================================
// POST、GETパラメータの受け取り
// 備考 :
// 更新 : 2012/11/29 KMK-Teraoka
//===============================================
if (DEBUG_MODE == 1)
{
extract($_POST);
extract($_GET);
Debug::writes($_POST);
}
$constId = isset($_POST["const_id"]) ? htmlspecialchars($_POST["const_id"]) : "";
$appId = isset($_POST["app_id"]) ? htmlspecialchars($_POST["app_id"]) : "";
$androidId = isset($_POST["android_id"]) ? htmlspecialchars($_POST["android_id"]) : "";
$_log->write("CONST_ID->". $constId. "\n");
$_log->write("APP_ID->". $appId. "\n");
$_log->write("TERMINAL_NAME->". $androidId. "\n");
Debug::write($constId, $appId, $androidId);
if (0 != strcmp($constId, "") && 0 != strcmp($appId, "") && 0 != strcmp($androidId, ""))
{
//================================================
// データベース接続
// 備考 :
// 更新 : 2012/11/29 KMK-Teraoka
//================================================
$conn = pg_connect("
host = ". $HOST. "
dbname = ". $DB. "
user = ". $USER. "
password= ". $PASS. "
");
if (!$conn)
{
throw new Exception("データベースへの接続に失敗しました");
}
//================================================
// 起動ステータスをON
// 備考 :
// 更新 : 2013/05/08 KMK-Teraoka
//================================================
$updRunningStatus = "UPDATE qgis.ts_terminal SET";
$updRunningStatus .= " running='0'";
$updRunningStatus .= " WHERE android_id='". $androidId. "'";
$updRunningStatus .= " AND const_id='". $constId. "'";
$updRunningStatus .= " AND app_id='". $appId. "'";
$updRunningStatus .= ";";
Debug::write($updRunningStatus);
$resRunnigStatus = pg_query($conn, $updRunningStatus);
}
}
catch(Exception $exc)
{
$_log->writeLog($exc->getMessage(). "\n");
}
//===============================================
// Postgresql終了処理
// 備考 :
// 更新 : 2012/10/19 KMK-Teraoka
//===============================================
pg_close($conn);
?>