Re: Another SYSTEM Function Question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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?

RTFM.

system() is just like the C version of the function in that it executes the given command and outputs the result.


Use exec:

exec() executes the given command, however it does not output anything. It simply returns the last line from the result of the command.


--
Postgresql & php tutorials
http://www.designmagick.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux