diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2006-08-20 00:29:17 +0000 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2006-08-20 00:29:17 +0000 |
commit | 665165fa4e5b888eaea1ef63e8553d05498238d7 (patch) | |
tree | 67ef824138b16db45adb8e5074992dd15ecbd315 /packages/miniupnpd | |
parent | eadccafb1b782b1d245a7c830ec3a65871aefc17 (diff) | |
download | pfsense-packages-665165fa4e5b888eaea1ef63e8553d05498238d7.tar.gz pfsense-packages-665165fa4e5b888eaea1ef63e8553d05498238d7.tar.bz2 pfsense-packages-665165fa4e5b888eaea1ef63e8553d05498238d7.zip |
Use regex to extract data. Makes this a lot more readable.
Diffstat (limited to 'packages/miniupnpd')
-rw-r--r-- | packages/miniupnpd/status_upnp.php | 68 |
1 files changed, 35 insertions, 33 deletions
diff --git a/packages/miniupnpd/status_upnp.php b/packages/miniupnpd/status_upnp.php index dae86878..b4a0606e 100644 --- a/packages/miniupnpd/status_upnp.php +++ b/packages/miniupnpd/status_upnp.php @@ -37,50 +37,52 @@ exec("/sbin/pfctl -aminiupnpd -sn", $rdr_entries, $pf_ret); $now = time(); $year = date("Y"); -$pgtitle = array(gettext("Status"),gettext("UPnP Status")); +$pgtitle = "Status: UPnP Status"; include("head.inc"); /* put your custom HTML head content here */ /* using some of the $pfSenseHead function calls */ -$pfSenseHead->addMeta("<meta http-equiv=\"refresh\" content=\"120;url={$_SERVER['SCRIPT_NAME']}\" />"); -echo $pfSenseHead->getHTML(); +//$pfSenseHead->addMeta("<meta http-equiv=\"refresh\" content=\"120;url={$_SERVER['SCRIPT_NAME']}\" />"); +//echo $pfSenseHead->getHTML(); ?> <body link="#0000CC" vlink="#0000CC" alink="#0000CC"> <?php include("fbegin.inc"); ?> +<p class="pgtitle"><?=$pgtitle?></font></p> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <div id="mainarea"> - <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr> - <td width="10%" class="listhdrr"><?=gettext("Port")?></td> - <td width="10%" class="listhdrr"><?=gettext("Protocol")?></td> - <td width="20%" class="listhdrr"><?=gettext("Internal IP")?></td> - <td width="60%" class="listhdr"><?=gettext("Description")?></td> - </tr> - <?php $i = 0; foreach ($rdr_entries as $rdr_entry) { - $rdr_label = split("\"", $rdr_entry); - $rdr_ip = split(" ", $rdr_label[2]); - $rdr_port = split(" ", $rdr_label[2]); - $rdr_proto = split(" ", $rdr_label[0]); - ?> - <tr> - <td class="listlr"> - <?php print $rdr_port[4];?> - </td> - <td class="listlr"> - <?php print $rdr_proto[5];?> - </td> - <td class="listlr"> - <?php print $rdr_ip[2];?> - </td> - <td class="listlr"> - <?php print $rdr_label[1];?> - </td> - </tr> - <?php $i++; }?> - </table> - </div> + <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td width="10%" class="listhdrr"><?=gettext("Port")?></td> + <td width="10%" class="listhdrr"><?=gettext("Protocol")?></td> + <td width="20%" class="listhdrr"><?=gettext("Internal IP")?></td> + <td width="60%" class="listhdr"><?=gettext("Description")?></td> + </tr> + <?php $i = 0; foreach ($rdr_entries as $rdr_entry) { + if (preg_match("/rdr on (.*) inet proto (.*) from any to any port = (.*) -> (.*) port (.*)/", $rdr_entry, $matches)) + $rdr_proto = $matches[2]; + $rdr_port = $matches[3]; + $rdr_ip = $matches[4]; + $rdr_label =$matches[5]; + ?> + <tr> + <td class="listlr"> + <?php print $rdr_proto;?> + </td> + <td class="listlr"> + <?php print $rdr_port;?> + </td> + <td class="listlr"> + <?php print $rdr_ip;?> + </td> + <td class="listlr"> + <?php print $rdr_label;?> + </td> + </tr> + <?php $i++; }?> + </table> + </div> </table> <?php include("fend.inc"); ?> |