If $lookup is passed from the client, then you should be careful with
that exec() call...

http://www.php.net/manual/en/ref.exec.php

Use one of the escape...() functions, perhaps?


-----Original Message-----
From: David Robley [mailto:[EMAIL PROTECTED]] 
Sent: Monday, July 23, 2001 12:47 AM
To: Tyler Longren; php-general
Subject: Re: [PHP] formatting "host" output


On Sat, 21 Jul 2001 06:32, Tyler Longren wrote:
> $data = exec("host $lookup");
> printf("<pre>%s</pre>", $data);
>
> How can I format the output of that properly?
> Sometimes, it's all on one line, and it's fine.
> Other times, there's more than one line...like if there was an alias.
>
> Any way to format it like it is on the command line?
>
> Thanks,
> Tyler

$data = exec("host $lookup", $ary);
while(list(,$val) = each($ary)) {
echo $val . '<BR>';
}

You need to assign the output of exec to an array if you want to capture

multiple lines of output. Check the manual for more detail.

-- 
David Robley      Techno-JoaT, Web Maintainer, Mail List Admin, etc
CENTRE FOR INJURY STUDIES      Flinders University, SOUTH AUSTRALIA  

   Try our NEW *SOLAR POWERED* tanning salon!

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED] To
contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to