$Latitude = $_POST['Latitude']; $Longitude = $_POST['Longitude']; $AddressZH = GetAddress("http://maps.google.com/maps/api/geocode/json?latlng=" . $Latitude . "," . $Longitude . "&sensor=true"); ParseGPS($DB, $AddressZH, $SendAccount); echo "{'state':'1001','message':'{$AddressZH}'}"; break; case 'add': $Note = $_POST['Note']; $SendAccount = $_POST['SendAccount']; $Latitude = $_POST['Latitude']; $Longitude = $_POST['Longitude']; $Altitude = $_POST['Altitude']; $AddressZH = GetAddress("http://maps.google.com/maps/api/geocode/json?latlng=" . $Latitude . "," . $Longitude . "&sensor=true"); $AddressEN = "a"; //GetAddress("http://maps.google.cn/maps/api/geocode/json?latlng=".$Latitude.",".$Longitude."&sensor=true");; AddNewMessage($DB, $Note, $SendAccount, $Latitude, $Longitude, $Altitude, $AddressZH, $AddressEN); echo "{'state':'1003','message':'SendMessageSucceed'}"; break; case 'gsm': $cellId = $_POST['cid']; $locationAreaCode = $_POST['lac']; $mobileCountryCode = $_POST['mcc']; $mobileNetworkCode = $_POST['mnc']; $imei = $_POST['imei']; $jsonString = FromGSMGetAddress($cellId, $locationAreaCode, $mobileCountryCode, $mobileNetworkCode); $arr = json_decode($jsonString, true); $latitude = empty($arr["location"]["latitude"]) ? 0.0 : $arr["location"]["latitude"]; $longitude = empty($arr["location"]["longitude"]) ? 0.0 : $arr["location"]["longitude"]; echo "{'state':'1002','message':'{$latitude},{$longitude}'}"; $address = GetAddress("http://maps.google.com/maps/api/geocode/json?latlng=" . $latitude . "," . $longitude . "&sensor=true"); GsmLog($DB, $cellId, $locationAreaCode, $mobileCountryCode, $mobileNetworkCode, $imei, $latitude, $longitude, $address);
<?php $CMD = $_POST["CMD"]; switch ($CMD) { case "ToShow": SetMessagesToShow(); break; case "AddNew": AddNewMessage(); break; } function SetMessagesToShow() { $count = $_POST["count"]; $msg = ""; $fileName = "messages.txt"; $handle = fopen($fileName, 'w') or die("can't open file"); if ($count != 0) { for ($i = 0; $i < $count; $i++) { $checked = $_POST["chkMsg_" . $i]; $msg = $checked . "##" . $_POST["msg_" . $i]; fwrite($handle, $msg . " \r\n"); } } fclose($handle); ReturnToMessages(); } function AddNewMessage() { $fileName = "messages.txt"; $handle = fopen($fileName, 'a') or die("can't open file"); $newMsg = $_POST["newMsg"];