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.
 
 
 
 
 
 

32 lines
925 B

<?php
date_default_timezone_set("Asia/Taipei");
$db_query = file_get_contents('php://input');
$myfile = fopen("receive_earthquake.txt", "a") or die("Unable to open file!");
#fwrite($myfile, date("Y-m-d H:i:s") . ": " . $db_query . "\n");
$db_query=json_decode($db_query,true);
#fwrite($myfile, date("Y-m-d H:i:s") . ": " . $db_query["secret_key"] . "\n");
fwrite($myfile, date("Y-m-d H:i:s") . ": " . $db_query["sql"] . "\n");
fclose($myfile);
if ($db_query["secret_key"] == "masada_earthquake_SS300"){
$host = 'db-104.coowo.com:3306';
$dbuser ='masadaroot';
$dbpassword = 'x6h5E5p#u8y';
$dbname = 'appwms';
$link = mysqli_connect($host,$dbuser,$dbpassword,$dbname);
if($link){
mysqli_query($link,'SET NAMES utf8');
$result = mysqli_query($link,$db_query["sql"]);
// echo "正確連接資料庫";
}
else {
echo "不正確連接資料庫</br>" . mysqli_connect_error();
}
mysqli_close($link);
}
?>