File "recv_ev.php"

Full path: /www/ansys/ttest/accmes/recv_ev.php
File size: 2.12 KiB (2174 bytes)
MIME-type: text/x-php
Charset: utf-8

Download   Open   Back

<?php
//-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
//	自動でクラスを参照する
//	関数名	:	__autoload()
//	備考	:	参照先は./class/XXX.phpとする
//	更新	:	2012/10/19 KMK-Teraoka
//-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
function __autoload($className)
{
	$fPath = "./class/" . str_replace("_", "/", $className) . ".php";
	require_once $fPath;
}

//===============================================
//	DEBUG_MODE
//	備考		:	
//	更新		:	2012/11/29 KMK-Teraoka
//===============================================
define("DEBUG_MODE", "1");
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/recv_ev.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);
	}
	$androidId = isset($_POST["android_id"]) ? htmlspecialchars($_POST["android_id"]) : "";
	$msec = isset($_POST["msec"]) ? htmlspecialchars($_POST["msec"]) : "";
	$evid = isset($_POST["evid"]) ? htmlspecialchars($_POST["evid"]) : "";
	$etc = isset($_POST["etc"]) ? htmlspecialchars($_POST["etc"]) : "";
	
	$_log->write("ADNROID_ID->". $androidId. "\n");
	$_log->write("EVID->". $evid. "\n");
	$_log->write("ETC->". $etc. "\n");
	
	if (strcmp($androidId, "") == 0)
	{
		throw new Exception("管理IDが指定されていません");
	}
	$fname = $androidId. ".txt";
	
	$dir = "./event";
	if (!file_exists($dir))
	{
		mkdir($dir, 0777);
		chmod($dir, 0777);
	}
	$fpath = $dir. "/". $fname;
	$fp = fopen($fpath, "a");
	if ($fp != null)
	{
		$buffer = $msec. "#". $evid. "#". $etc. "\n";
		fputs($fp, $buffer);
		fclose($fp);
	}
}
catch(Exception $exc)
{
	$_log->write($exc->getMessage(). "\n");
}
?>

PHP File Manager