parent
6da73e7518
commit
f89e60e85f
4 changed files with 72 additions and 0 deletions
@ -0,0 +1,19 @@ |
|||||||
|
<?php
|
||||||
|
include '../../functions.php'; |
||||||
|
|
||||||
|
header('Access-Control-Allow-Origin:*'); |
||||||
|
|
||||||
|
$version = $_REQUEST['version']; |
||||||
|
|
||||||
|
if(isset($version)){ |
||||||
|
if($version != "v0.1.4") |
||||||
|
echo json_encode(array("update" => 1)); |
||||||
|
else |
||||||
|
echo json_encode(array('update' => 0)); |
||||||
|
|
||||||
|
yimian__log("log_wiot", array("timestamp" => date('Y-m-d H:i:s', time()), "ip" => ip2long(get_ip()), "version" => $version /* 经md5不可逆加密,仅用于区分用户 */)); |
||||||
|
|
||||||
|
die(); |
||||||
|
} |
||||||
|
|
||||||
|
echo "This Page is only for wIoT OTA!!"; |
@ -0,0 +1,24 @@ |
|||||||
|
<?php |
||||||
|
header('Access-Control-Allow-Origin:*'); |
||||||
|
header('Content-type: text/plain; charset=utf8', true); |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
sendFile('./wiot.bin'); |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Function to send file to ESP8266 |
||||||
|
function sendFile($path) { |
||||||
|
header($_SERVER["SERVER_PROTOCOL"].' 200 OK', true, 200); |
||||||
|
header('Content-Type: application/octet-stream', true); |
||||||
|
header('Content-Disposition: attachment; filename='.basename($path)); |
||||||
|
header('Content-Length: '.filesize($path), true); |
||||||
|
header('x-MD5: '.md5_file($path), true); |
||||||
|
readfile($path); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
?> |
Binary file not shown.
Loading…
Reference in new issue