Re: whoami explanation

From: Date: Tue, 03 Mar 2009 16:41:25 +0000
Subject: Re: whoami explanation
References: 1 2 3 4 5 6  Groups: php.general 
Request: Send a blank email to php-general+get-289155@lists.php.net to get a copy of this message
Daniel Brown wrote: > 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. > I'll try to digest all this today if not sooner... :-) As to the sanitize, that is on my list of todos; I am not doing it as, for the moment, I am only developing on my intranet server and do not fear much external threats... anyway, "inch Allah" :-) I appreciate the input and I take the chastizing with a ton of salt. -- Phil Jourdan --- pj@ptahhotep.com http://www.ptahhotep.com http://www.chiccantine.com

« previous php.general (#289155) next »