Re: [PHP] Weird problem with is_file()
On 25 April 2010 22:14, Michelle Konzack linux4miche...@tamay-dogan.net wrote: Hi, I have a code sniplet which does not work and I do not know why: 8-- $isfile=shell_exec(ls /tmp/tdphp-vserver/SESSION_ . $_SERVER['REMOTE_ADDR'] . _ . $_COOKIE['VSERVER_AUTHUSER'] . _* |head -n1); if (is_file($isfile)) { snip 8-- nothing special, and the file is there, but the stuff with is_file($isfile) is not working... If I enter the file in place of $isfile, then it is working. Quoting of $isfile does not work too. What have a overseen? var_dump($isfile); Don't make assumptions of what the value is, just check it. Regards Peter -- hype WWW: http://plphp.dk / http://plind.dk LinkedIn: http://www.linkedin.com/in/plind Flickr: http://www.flickr.com/photos/fake51 BeWelcome: Fake51 Couchsurfing: Fake51 /hype -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Weird problem with is_file()
2010/4/25 Michelle Konzack linux4miche...@tamay-dogan.net: Hi, I have a code sniplet which does not work and I do not know why: 8-- $isfile=shell_exec(ls /tmp/tdphp-vserver/SESSION_ . $_SERVER['REMOTE_ADDR'] . _ . $_COOKIE['VSERVER_AUTHUSER'] . _* |head -n1); Hi Michelle, I would recommend not to let any user input to your shell. This piece of code is very insecure as any client may manipulate the shell command at will. You don't want people to take over your server that easily. See http://www.php.net/escapeshellcmd and alike. Regards -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Weird problem with is_file()
Hi, I have a code sniplet which does not work and I do not know why: 8-- $isfile=shell_exec(ls /tmp/tdphp-vserver/SESSION_ . $_SERVER['REMOTE_ADDR'] . _ . $_COOKIE['VSERVER_AUTHUSER'] . _* |head -n1); if (is_file($isfile)) { snip 8-- nothing special, and the file is there, but the stuff with is_file($isfile) is not working... If I enter the file in place of $isfile, then it is working. Quoting of $isfile does not work too. What have a overseen? Oh, if you think, it is an array, no it is not, because otherwise if (is_array($isfile)) { would work. Thanks, Greetings and nice Day/Evening Michelle Konzack signature.pgp Description: Digital signature
Re: [PHP] Weird problem with is_file()
Hi Michelle, Maybe try adding an error catch to see what you get. if(is_file($isFile)) or die(mysql_error()); On Apr 25, 2010, at 3:14 PM, Michelle Konzack wrote: if (is_file($isfile)) { Karl DeSaulniers Design Drumm http://designdrumm.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Weird problem with is_file()
Oops, my apologies. That is a PHP MySQL solution. Wrong list. Please disregard that solution. Maybe find a way to get an error response from your session to see what the problem is. Karl On Apr 25, 2010, at 3:24 PM, Karl DeSaulniers wrote: Hi Michelle, Maybe try adding an error catch to see what you get. if(is_file($isFile)) or die(mysql_error()); On Apr 25, 2010, at 3:14 PM, Michelle Konzack wrote: if (is_file($isfile)) { Karl DeSaulniers Design Drumm http://designdrumm.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Karl DeSaulniers Design Drumm http://designdrumm.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php