mwexec("/sbin/ipfw delete {$ruleno}; /sbin/ipfw delete " . ++$ruleno); } unset($a_passthrumacs[$idx]); write_config(); echo gettext("The entry was sucessfully 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']]) { $ruleno = captiveportal_get_ipfw_passthru_ruleno($a_passthrumacs[$_GET['id']]['mac']); if ($ruleno) { captiveportal_ipfw_set_context($cpzone); captiveportal_free_ipfw_ruleno($ruleno); mwexec("/sbin/ipfw delete {$ruleno}; /sbin/ipfw delete " . ++$ruleno); } unset($a_passthrumacs[$_GET['id']]); write_config(); header("Location: services_captiveportal_mac.php?zone={$cpzone}"); exit; } } include "head.inc"; include "fbegin.inc"; ?> <body link="#0000CC" vlink="#0000CC" alink="#0000CC">
} if ($_POST['username']) { $mac['username'] = $_POST['username']; } $mac['descr'] = $_POST['descr']; if (isset($id) && $a_passthrumacs[$id]) { $oldmac = $a_passthrumacs[$id]['mac']; $a_passthrumacs[$id] = $mac; } else { $oldmac = $mac['mac']; $a_passthrumacs[] = $mac; } passthrumacs_sort(); write_config(); if (isset($config['captiveportal'][$cpzone]['enable'])) { $ruleno = captiveportal_get_ipfw_passthru_ruleno($oldmac); if ($ruleno) { captiveportal_free_ipfw_ruleno($ruleno); $rules = "delete {$ruleno}\n"; $rules .= "delete " . ++$ruleno . "\n"; } $rules .= captiveportal_passthrumac_configure_entry($mac); file_put_contents("{$g['tmp_path']}/{$cpzone}_tmpmacedit{$id}", $rules); captiveportal_ipfw_set_context($cpzone); mwexec("/sbin/ipfw -q {$g['tmp_path']}/{$cpzone}_tmpmacedit{$id}"); @unlink("{$g['tmp_path']}/{$cpzone}_tmpmacedit{$id}"); } header("Location: services_captiveportal_mac.php?zone={$cpzone}"); exit; } }