You are here: Re: Custom directory listing and $_GET question « PHP Programming Language « IT news, forums, messages
Re: Custom directory listing and $_GET question

Posted by Matt Madrid on 08/06/07 18:14

techusky@gmail.com wrote:
[snip]
>
>
> <?php
>
> // Tell the script which directory to list
> $nav = $_GET['nav'];
> $dir = getcwd() . "\\" . $nav;

I gather from the "\\" that you are on a windows platform. No need
to use "\\", a "/" will do and make your code more portable.

[snip]
> if (!is_dir($file))

Here's your problem. You need to prepend the dirname to the filename
since you are not "in" the directory in question.

if (!is_dir("$dir/$file"))

The same goes for your other calls to is_dir() and is_file()

Matt M.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация