Script to toggle rule
-
Hello
i'd like to make an easy interface to toggle rules on the fly from an ios or android device, to switch parameters on the fly.
So my first need is to easyly toggle rules
I've seen this post : https://forum.pfsense.org/index.php?topic=56751.0
It's exactely what i need :
- i've understand i can toggle a rule with a POST method like :
http://router_adress/firewall_rules.php?if=lan&act=toggle&id=4
Then to validate the rule toggle, i need to use a script php the guy on the post propose :
require_once("config.inc"); require_once("functions.inc"); require_once("filter.inc"); require_once("shaper.inc"); require_once("ipsec.inc"); require_once("vpn.inc"); /* invalidate interface cache */ get_interface_arr(true); $retval = 0; $retval = filter_configure(); clear_subsystem_dirty('filter'); pfSense_handle_custom_code("/usr/local/pkg/firewall_rules/apply"); echo "The settings have been applied. The firewall rules are now reloading in the background. ";
So i put this script as the file "done.php", inside /usr/local/www.
but when i try with my browser to post this php script, with
http://router_adress/done.php
it doesn't execute the php script, it only shows the content of the script as an html file.
What did i do wrong ?
Thanks !!!
-
http://php.net/manual/en/language.basic-syntax.phptags.php
-
Thank you !
Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.