Files
webgui/emhttp/plugins/dynamix/include/update.rules.php
2023-11-03 12:36:03 +01:00

22 lines
737 B
PHP

<?PHP
/* Copyright 2005-2023, Lime Technology
* Copyright 2012-2023, Bergware International.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*/
?>
<?
$cfg = $_POST['#cfg'];
foreach ($_POST as $name => $mac) {
if ($name[0]=='#') continue;
$row = exec("grep -n '$mac' ".escapeshellarg($cfg)."|cut -d: -f1");
if ($row) exec("sed -ri '{$row}s/(NAME=\")[^\"]+/\\1{$name}/' ".escapeshellarg($cfg));
}
exec("touch /tmp/network-rules.tmp");
$save = false;
?>