You are here: Re: Point script "snif" to different directory? « PHP Programming Language « IT news, forums, messages
Re: Point script "snif" to different directory?

Posted by feed_sheep on 04/28/06 20:58

> "Snif" is an excellent little script to index files and directories. It's
> just one single file, and the advantage is that you merely drop it into
> the directory you want to index, point a browser to the script and you're
> done.
>
> But to me, the simplicity is a DISadvantage since I need to index
> directories that are located down in the site hierarcy, and to which the
> users won't have direct access.
>
> Have tried keeping "snif" in the directory I want indexed and then use
> include to a "parent" file in root. But of course, it's indexing the root
> and not the directory where the script is located. Also tried a regular
> iframe, but that's plain ugly with scrollbars, etc.
>

I'm sure the regulars can offer more help than I, but I think your post is
confusing. Why won't the users have direct access to the directories down
in the hierarchy? Is it outside of the public html directory? Anyway, I
think the answer to your question is found in lines 238-280 of the file you
linked (see below). If I read this correctly, there is a small index.php
file included with this snif package that you put into each subdirectory.
That automatically handles links to files below this big index.php in the
site hierarchy.

David
-----------

****************************************************************************
** HANDLING SUBDIRECTORY LISTINGS **
****************************************************************************

Say you've put the snif index.php into www.yourhost.com/download.
Now somebody makes a request to www.yourhost.com/download/releases. In
order to deal with this properly, you would have to copy the snif index.php
to that directory, too. But this will prevent the user to go to
www.yourhost.com/download from www.yourhost.com/download/releases
directly by selecting the .. link.

If you have this situation, use the index.php file from the subdirectory
called "subdir" in the snif archive file. All it does is automatically
forward the user to the parent directory and set URL parameters so that
the real snif will handle the request.

OK, that may be confusing. Again, a simple example:


/download/descript.ion << descriptions for
/download/*.*
/download/index.php << this file you're reading
now, >25 KB
/download/license.txt
/download/notes.txt
/download/releases/bigprogram_2.0.zip
/download/releases/descript.ion << descriptions for
/download/releases/*.*
/download/releases/index.php << subdir/index.php, <2 KB
/download/releases/nightly/2.1_20031103.zip
/download/releases/nightly/2.1_20031104.zip
/download/releases/nightly/index.php << subdir/index.php, <2 KB


If a users points his browser to
www.yourhost.com/download/releases/nightly/

The small index.php will forward him to
www.yourhost.com/download/releases/?path=nightly/

And then the index file in that directory will forward him again, this time
to
www.yourhost.com/download/?path=releases/nightly/

Now we've reached the directory with the real snif (should get a copyright
on
that phrase ;-)), which will take over and miraculously lists the directory
the user typed as an URL.

 

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

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