Banner

Sponsor

Login


Welcome Back!
Guest
Guest

Register

Lost your password?

67 users online



directory indexer

directory indexer

Currently viewing this thread: 1 (0 members and 1 guests)


Page 1 out of 2
jadedchron

jadedchron

Neverside Newbie
Status: Offline!

directory indexer

Hey, i asked a very similar question on here before and after a lot of research I've found that most of the scripts that I've found needed access to httpd.conf of which I don't have access to (as i'm under a host and simply need to index a few directories). I tried using other scripts but most did not work or needed the FTP functions in the comp.

I was wondering if anyone could point me in the direction of a directory indexer script they wrote or knew of one that had doc/config's well commented and didn't need the aforementioned above. I hope I put this in the right category - Thanks,

nick o'las

___________________

Nick
Pixel-Infinity

Bot

Bot

Status: Offline!

Well I don't know of a single script in particular, but here are some sites that could lend a hand.

http://www.totalscripts.com/pages/Perl_Scripts/Navigation/
http://www.hotscripts.com/cgi-bin/search.cgi?bool=AND&a ... ndexer&catid=all
http://www.yagb.de/

Hope this helps bud. Grin

___________________

"School prepares you for life, which also sucks."

-Bot

jadedchron

jadedchron

Neverside Newbie
Status: Offline!

Bummer. I don't think my host supports PERL /CGI scripts. Tried all of the ones over at hotscripts and my german isn't any good Sad Thanks for the links though. I really appreciate it.

___________________

Nick
Pixel-Infinity

CDude

CDude

nothing
Status: Offline!

here is a function that i used in one of my script, could use some tweaking though since i only write it to do the job, not do it well.

PHP:

<?php

function list_files($root$path$url$in)
{
    
$root rtrim($root'/') . '/';
    
$path rtrim($path'/') . '/';
    if(
$path == '/') { $path '';}
    
$url rtrim($url'/') . '/';
    
$dir $root $path;
    
$h = @opendir($dir);
    if(!
$h)
    {
        return array();
    }
    
$files = array();
    while(
false != ($f readdir($h)))
    {
        if(
$f != '..' && $f != '.' && $f != '.htaccess')
        {
            if(!
is_dir($root.$path.$f))
            {
                
array_push($files, array('name' => $f'url' => $url $path $f'size' => filesize($root.$path.$f), 'time' => filemtime($root.$path.$f), 'type' => extension($f) ) );
            }
            else
            {
                
array_unshift($files, array('name' => $f'url' => 'index.php?action=browse&amp;in='.$in.'&amp;dir=' $path $f'size' => '-''time' => '-''type' => 'dir'));
            }
        }
    }
    if(
$path != '')
    {
        
array_unshift($files, array('name' => 'Up one dir''url' => 'index.php?action=browse&amp;in='.$in.'&amp;dir=' . (dirname($path)=='.' '' dirname($path)), 'size' => '-''time' => '-''type' => 'dir'));
    }
    return 
$files;
}

?>

___________________

http://celerondude.com

jadedchron

jadedchron

Neverside Newbie
Status: Offline!

thanks dude i'll try and figure it out.

___________________

Nick
Pixel-Infinity

jadedchron

jadedchron

Neverside Newbie
Status: Offline!

Ok I have a pretty simple indexer. On it, it displays the location at the top and says: "You are here: /home/username/thesite/" I was hoping someone could tell me how I could strip off the front of the specified absolute path so it's simply thesite - that way it's not tacky looking. I'm not real sure how to go about it. Maybe using some sort of Left function or something. I dunno

the lophty indexer (http://dev.lophty.com/indexer/) has it perfect at the top but i couldn't figure out how he set it up/stripped it down.

hey my avatar title should be 'Avid Pain In The ***' instead of Avid Help Roll Eyes

appreciate the newbie patience,
nick o'las

___________________

Nick
Pixel-Infinity

CDude

CDude

nothing
Status: Offline!

explode ( '/', $path );

___________________

http://celerondude.com

jadedchron

jadedchron

Neverside Newbie
Status: Offline!

hmm gives me 'Array' so going to try and figure out why. Thanks (C)Dude Grin

___________________

Nick
Pixel-Infinity

Kickboy

Kickboy

Neverside Newbie
Status: Offline!

Gives you 'Array' because the explode() function turns it into an array.

$path = "/home/username/thesite/";
explode( '/', $path);

To get 'thesite' you would do
echo $path[2];

$path[0] = ""
$path[1] = "home"
$path[2] = "username"
$path[3] = "thesite"

hope that helps Smile

For more help you can always visit www.php.net
Here is the link to the explode function for more help:
http://www.php.net/manual/en/function.explode.php

Edit: made a mistake in that... fixed it

___________________

I don't suffer from insanity; I enjoy every minute of it.
Unintended Theory | Cacrew v4

Last edited by Kickboy, August 31st, 2003 01:57 AM (Edited 1 times)

jadedchron

jadedchron

Neverside Newbie
Status: Offline!

interesting interesting.. hey i'm learning! Shocked so the only problem after that is.. if the $path changed.. ie the user clicked into a sub-directory

$path = '/home/username/thesite/sub/';

somehow i guess i'd have to get hte total count of the arrays and grab the highest number? hmm

thinkin,
nick

*EDIT: array_reverse ($explodedpath); seemed to do the trick for now - Thanks! thanks!! thanks!!! ;-) *

___________________

Nick
Pixel-Infinity

Last edited by jadedchron, August 31st, 2003 01:52 AM (Edited 1 times)

Page 1 out of 2
Quick Jump:

Main Navigation


Site & Graphic Design by Aeon Tan
Developed by Jeremie Pelletier & Scott Roach


NeverAPI generated this page in 0.0106 seconds.