Running iptables from PHP
Running Apache 2, i have a php webpage and i want to be able to enter in 192.168.1.1 in a field press a submit button. Then when i press it i want to be able to ALLOW or BLOCK the ipaddress using iptables.
using BASH the command would be iptables -A INPUT -s 192.168.1.1 -P ICMP -J DROP
i want to be able to do this in php i save the 192.168.1.1 or any other address as a variable $ip_address and import it into the following code?
echo exec('iptables -A INPUT -s $ip_address -j DROP');
im not sure if this is the correct code, i want to be able to block or allow it then display the results on the wedpage.
the reason i am doing this is for a project and cannot be done any other way!
could someone shed some light i have spent hours on the web searching how to do this and with no luck, this is a last resort and would really appreciate the help, if offered.