Re: Another SYSTEM Function Question
| From: | Jochem Maas | Date: | Fri, 27 Apr 2007 11:28:07 +0000 |
| Subject: | Re: Another SYSTEM Function Question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-253969@lists.php.net to get a copy of this message | ||
Nathaniel Hall wrote:
> I have another question regarding running a system command on a web
> server. Let me explain again, I am creating a login page that is to be
> used on my local lan only. I am wanting to lock down a maximum number
> of logins to up to 2 MAC addresses. I finally got the arp command
> working, but now I have another issue with new lines.
>
> The command I am running is system("arp " . $_SERVER['REMOTE_ADDR'] .
> "
> | grep " . $_SERVER['REMOTE_ADDR'] . " | cut -b34-50");
>
> The command runs correctly, however the output is directly and not by
> using echo. I would like to be able to assign what is returned to a
> variable so that I can do additional work on it. Any ideas?
http://php.net/manual/en/function.exec.php
use the third argument to retrieve the command/shell output.
>
> --
> Nathaniel Hall, GSEC GCFW GCIA GCIH GCFA
>