Point script "snif" to different directory?

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

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

So, maybe it's not kosher to ask about things like this, but I do it  
anyway and hope I'm not upsetting anyone;

Can someone help me change the instances in the script which points to  
"itself" so that it can index another directory?

The script is here: http://www.bitfolge.de/download/source/snif.phps

Cheers, and a BIG thanks in advance to anyone who can help.


Re: Point script "snif" to different directory?

Danny Boy wrote:

Quoted text here. Click to load it

I'm bumping this.
I am prepared to pay for the help.


Re: Point script "snif" to different directory?

Quoted text here. Click to load it

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.


**  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/index.php                          << this file you're reading  
now, >25 KB
/download/releases/descript.ion              << descriptions for  
/download/releases/index.php                 << subdir/index.php, <2 KB
/download/releases/nightly/index.php         << subdir/index.php, <2 KB

If a users points his browser to

The small index.php will forward him to

And then the index file in that directory will forward him again, this time  

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

Site Timeline