You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1.3 KiB
42 lines
1.3 KiB
<?php
|
|
date_default_timezone_set("Asia/Taipei");
|
|
function save_log_response($key, $pid, $account, $current_version, $version, $response_result){
|
|
# 儲存紀錄並輸出
|
|
#echo date("Y-m-d");
|
|
$file_path = "version_log/" . $account . "-" . date("Y-m-d") . ".ini";
|
|
$data = $key . ";" . $pid . ";" . date("H:i:s") . ";" . $current_version . ";" . $version . "\n";
|
|
$fp = fopen($file_path,"a"); # 如果檔案不存在擇嘗試建立再寫入
|
|
fwrite($fp, $data);
|
|
fclose($fp);
|
|
echo json_encode($response_result, JSON_UNESCAPED_UNICODE);
|
|
}
|
|
|
|
header('Content-type:text/json');
|
|
$current_version = "1.0.0";
|
|
$key = $_REQUEST["key"];
|
|
$account = $_REQUEST["account"];
|
|
$pid = $_REQUEST["pid"];
|
|
$version = $_REQUEST["version"];
|
|
|
|
if (($key != NULL) and ($account != NULL) and ($pid != NULL)) {
|
|
if ($current_version != $version) {
|
|
#回覆結果
|
|
$response_result = array(
|
|
"result_code" => "0",
|
|
"latest_version" => $current_version,
|
|
"user_version" => $version,
|
|
"note" => "Need to be upgraded!"
|
|
);
|
|
save_log_response($key, $pid, $account, $current_version, $version, $response_result);
|
|
}
|
|
else {
|
|
$response_result = array(
|
|
"result_code" => "1",
|
|
"latest_version" => $current_version,
|
|
"note" => "None"
|
|
);
|
|
echo json_encode($response_result, JSON_UNESCAPED_UNICODE);
|
|
};
|
|
};
|
|
|
|
?>
|