@unlink("{$g['tmp_path']}/{$uniqid}_tmp"); unset($a_passthrumacs[$idx]); write_config(); echo gettext("The entry was successfully deleted") . "\n"; } else { echo gettext("No entry exists for this mac address:") . " " . $_POST['delmac'] . "\n"; } } exit; } } if ($_GET['act'] == "del") { $a_passthrumacs =& $a_cp[$cpzone]['passthrumac']; if ($a_passthrumacs[$_GET['id']]) { $cpzoneid = $a_cp[$cpzone]['zoneid']; $rules = captiveportal_passthrumac_delete_entry($a_passthrumacs[$_GET['id']]); $uniqid = uniqid("{$cpzone}_mac"); file_put_contents("{$g['tmp_path']}/{$uniqid}_tmp", $rules); mwexec("/sbin/ipfw -x {$cpzoneid} -q {$g['tmp_path']}/{$uniqid}_tmp"); @unlink("{$g['tmp_path']}/{$uniqid}_tmp"); unset($a_passthrumacs[$_GET['id']]); write_config(); header("Location: services_captiveportal_mac.php?zone={$cpzone}"); exit; } } include "head.inc"; if ($savemsg) { print_info_box($savemsg, 'success'); } if (is_subsystem_dirty('passthrumac')) {
if ($_POST['username']) { $mac['username'] = $_POST['username']; } $mac['descr'] = $_POST['descr']; if (isset($id) && $a_passthrumacs[$id]) { $oldmac = $a_passthrumacs[$id]; $a_passthrumacs[$id] = $mac; } else { $oldmac = $mac; $a_passthrumacs[] = $mac; } passthrumacs_sort(); write_config(); if (isset($config['captiveportal'][$cpzone]['enable'])) { $cpzoneid = $config['captiveportal'][$cpzone]['zoneid']; $rules = captiveportal_passthrumac_delete_entry($oldmac); $rules .= captiveportal_passthrumac_configure_entry($mac); $uniqid = uniqid("{$cpzone}_macedit"); file_put_contents("{$g['tmp_path']}/{$uniqid}_tmp", $rules); mwexec("/sbin/ipfw -x {$cpzoneid} -q {$g['tmp_path']}/{$uniqid}_tmp"); @unlink("{$g['tmp_path']}/{$uniqid}_tmp"); unset($cpzoneid); } header("Location: services_captiveportal_mac.php?zone={$cpzone}"); exit; } } // Get the MAC address $ip = $_SERVER['REMOTE_ADDR']; $mymac = `/usr/sbin/arp -an | grep '('{$ip}')' | head -n 1 | cut -d" " -f4`; $mymac = str_replace("\n", "", $mymac);