Re: whoami explanation
| From: | Daniel Brown | Date: | Tue, 03 Mar 2009 16:30:43 +0000 |
| Subject: | Re: whoami explanation | ||
| References: | 1 2 3 4 5 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-289149@lists.php.net to get a copy of this message | ||
On Tue, Mar 3, 2009 at 11:22, PJ <af.gourmet@videotron.ca> wrote:
>>
> Ok, but how does this relate to a command passed from a php Web page?
> I don't understand the processus.
> I use bash on my FreeBSD and have not needed a back quote yet that I can
> recall... and on WinXP?
As in the email I just sent, remember to sanitize any commands
passed from the web (or anywhere, for that matter), but here are some
examples.
<?php
$name = "Dan";
echo "Hello, my name is $name."; // Output: Hello, my name is Dan.
echo 'Hello, my name is $name.'; // Output: Hello, my name is $name.
echo
Hello, my name is $name.; // Will run "Hello, my name is
Dan." run as a shell command.
$name = whoami; // Presume that your Linux web server is as user
'apache'.
echo "Hello, my name is $name."; // Output: Hello, my name is apache.";
echo 'Hello, my name is $name.'; // Output: Hello, my name is $name.
?>
Single quotes means literal, double quotes means translatable, and
backticks means executable.
--
</Daniel P. Brown>
daniel.brown@parasane.net || danbrown@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
50% Off All Shared Hosting Plans at PilotPig: Use Coupon DOW10000