Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
stsdc committed Mar 24, 2017
1 parent 2d1d922 commit 05540fb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 6 additions & 0 deletions lib/ultron/ultron.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,11 @@ function write_all_the_shit ($esp_data) {
echo 'OK';
}

function isESP ($esp_data) {
if(check_header('HTTP_USER_AGENT', 'ESP8266-IoT') OR isset($esp_data) OR check_header('HTTP_ESP8266_AUTH_KEY', 'e9b4dbb90c565d901b086169e77c8eaf')) {
return true;
}
}


?>
6 changes: 2 additions & 4 deletions page-templates/lab.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,13 @@
*/
?>
<?php
if(!check_header('HTTP_USER_AGENT', 'ESP8266-IoT') OR !isset($_SERVER['HTTP_ESP8266_DATA']) OR !check_header('HTTP_ESP8266_AUTH_KEY', 'e9b4dbb90c565d901b086169e77c8eaf')) {
if(!isESP($_SERVER['HTTP_ESP8266_DATA'])) {
//header($_SERVER["SERVER_PROTOCOL"].' 403 Forbidden', true, 403);
get_header();
get_template_part('parts/topbar');
get_ultron_body();
// read_json_and_push(0, 88888);
// read_json_and_push(0, 88888);
// write_all_the_shit(0);


get_footer();
exit();

Expand Down

0 comments on commit 05540fb

Please sign in to comment.