[UPHPU] Running linux commands in php

Ray Hunter bigdog at venticon.com
Wed Oct 13 13:00:23 MDT 2004


On Wed, 2004-10-13 at 12:54, Brent Wilkinson wrote:
> I am trying to run a linux command in php on a new install and doesn't want
> to seem to do it any ideas?
> 
> if ($newMac == -1)
> {
>  // bind new mac address here
> 
> $query = "update user set mac='$mac', last_access='$newDate' where
> user_name='$uname' and password='$upass'";
> $result = mysql_query($query) or die ("COULD NOT BIND MAC!");
> $query = "insert into bind_log values('$uname','$mac','$newDate')";
> $result = mysql_query($query) or die ("Unable to bind in bind log");
> /* these are the lines with problems
> `/usr/bin/sudo /usr/sbin/iptables -I FORWARD 1 -m mac --mac-source $mac -j
> ACCEPT`;
> `/usr/bin/sudo /usr/sbin/iptables -t nat -I PREROUTING 1 -m mac --mac-source
> $mac -j ACCEPT`;
> $forward = $login_success_page;
> }

the user that is running php needs to be added to the sudoers file.

--
Ray




More information about the UPHPU mailing list