diff --git a/configurator.db b/configurator.db index 4f7e552..4c7999d 100644 Binary files a/configurator.db and b/configurator.db differ diff --git a/configurator.php b/configurator.php index 0ddac7d..2c3d6b3 100644 --- a/configurator.php +++ b/configurator.php @@ -47,7 +47,8 @@ if($getconfig == "1") { // When called with id and applied=1, mark as applied if(strlen($id) > 0 && $applied == "1") { try { - $updateapplied = $db->prepare("UPDATE DEVICES SET APPLIED=1 WHERE id=:id;"); + $updateapplied = $db->prepare("UPDATE DEVICES SET APPLIED=1, CURRENTIP=:currentip WHERE id=:id;"); + $updateapplied->bindParam(':currentip', $_SERVER['REMOTE_ADDR']); // store the remote client IP for calling blink.php later $updateapplied->bindParam(':id', $id); $updateapplied->execute(); } catch (Exception $e) { diff --git a/index.php b/index.php index 5c9184b..84bc8bb 100644 --- a/index.php +++ b/index.php @@ -1,12 +1,12 @@ array('filter' => FILTER_SANITIZE_NUMBER_INT, 'flags' => FILTER_REQUIRE_ARRAY))); -if(isset($configdevices['configdevices'])) +if(isset($configdevices['configdevices'])) // we don't want the whole GET array, just the configdevices part. $configdevices = $configdevices['configdevices']; $applied = filter_input(INPUT_GET, 'applied', FILTER_SANITIZE_NUMBER_INT); $download = filter_input(INPUT_GET, 'download', FILTER_SANITIZE_SPECIAL_CHARS); @@ -30,7 +30,7 @@ try { // Create table if doesn't exist $q = $db->query("PRAGMA table_info(DEVICES)"); if ( $q->rowCount() == 0 ) { - $db->query( "CREATE TABLE DEVICES ( id INTEGER PRIMARY KEY, config TEXT, ready INTEGER, sent INTEGER, applied INTEGER );" ); + $db->query( "CREATE TABLE DEVICES ( id INTEGER PRIMARY KEY, config TEXT, currentip CHAR(255), ready INTEGER, sent INTEGER, applied INTEGER );" ); } @@ -91,8 +91,10 @@ if($configdevices != false && count($configdevices) > 0) {

Devices

- - + +