diff --git a/supervisor/checker.php b/supervisor/checker.php index 934bbaa..34539fd 100755 --- a/supervisor/checker.php +++ b/supervisor/checker.php @@ -5,7 +5,7 @@ => Check if we need to turn on or turn off a device */ - require '../config/include.php'; + require __DIR__ . '/../config/include.php'; // Returns all devices that match the $time_columnName, $prog_state and $active // ==> All devices that should be activated of disactivated according to the DB diff --git a/supervisor/command.php b/supervisor/command.php index 2ce2821..ab6dddd 100755 --- a/supervisor/command.php +++ b/supervisor/command.php @@ -5,7 +5,7 @@ => Turn on or off a device */ - require '../config/include.php'; + require __DIR__ . '/../config/include.php'; $args_requiredNB = 3; // Returns all device info that match $id id @@ -46,11 +46,13 @@ function getCode($device, $origin, $command){ $values = array(); foreach($arguments as $arg){ - list($x, $y) = explode('=', $arg); - $values["$x"] = $y; + $elems = explode('=', $arg); + if(count($elems) == 2){ + $values["$elems[0]"] = $elems[1]; + } } - $nb = count($values) - 1; + $nb = count($values); } $command = $values['command']; // ON or OFF diff --git a/web/device_edit.php b/web/device_edit.php index e7ab6a1..ce9aa3e 100644 --- a/web/device_edit.php +++ b/web/device_edit.php @@ -47,9 +47,19 @@
  • -
    Code
    +
    Code d'allumage
    +
    + +
    +
    +
    +
  • +
  • +
    +
    +
    Code d'éxtinction
    - +
    diff --git a/web/post_device_edit.php b/web/post_device_edit.php index 46de386..142c955 100644 --- a/web/post_device_edit.php +++ b/web/post_device_edit.php @@ -14,7 +14,8 @@ $id = $_POST['id']; $name = $_POST['name']; - $code = $_POST['code']; + $code_on = $_POST['code_on']; + $code_off = $_POST['code_off']; $prog_on_state = 0; // Initialization to 0 because if the checkbox is not checked, it won't exist $prog_on_time = $_POST['prog_on_time']; @@ -43,7 +44,8 @@ // Update $query = "UPDATE devices SET name = '". $name ."', - code = '". $code ."', + code_on = '". $code_on ."', + code_off = '". $code_off ."', prog_on_state = ". $prog_on_state .", prog_on_time = '". $prog_on_time ."',