Re: whoami explanation

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

 



On Tue, Mar 3, 2009 at 11:22, PJ <af.gourmet@xxxxxxxxxxxx> 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@xxxxxxxxxxxx || danbrown@xxxxxxx
http://www.parasane.net/ || http://www.pilotpig.net/
50% Off All Shared Hosting Plans at PilotPig: Use Coupon DOW10000

-- 
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