
August 29th, 2003
02:24 AM
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

August 29th, 2003
05:27 AM
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. 
___________________
"School prepares you for life, which also sucks."
-Bot

August 29th, 2003
07:58 AM
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
Thanks for the links though. I really appreciate it.
___________________
Nick
Pixel-Infinity

August 29th, 2003
08:00 AM

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
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&in='.$in.'&dir=' . $path . $f, 'size' => '-', 'time' => '-', 'type' => 'dir'));
}
}
}
if($path != '')
{
array_unshift($files, array('name' => 'Up one dir', 'url' => 'index.php?action=browse&in='.$in.'&dir=' . (dirname($path)=='.' ? '' : dirname($path)), 'size' => '-', 'time' => '-', 'type' => 'dir'));
}
return $files;
}
?>
___________________
http://celerondude.com

August 29th, 2003
09:06 PM
Neverside Newbie
Status: Offline!
thanks dude i'll try and figure it out.
___________________
Nick
Pixel-Infinity

August 30th, 2003
11:35 PM
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
appreciate the newbie patience,
nick o'las
___________________
Nick
Pixel-Infinity

August 31st, 2003
01:05 AM
Neverside Newbie
Status: Offline!
hmm gives me 'Array' so going to try and figure out why. Thanks (C)Dude 
___________________
Nick
Pixel-Infinity

August 31st, 2003
01:24 AM
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 
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)

August 31st, 2003
01:29 AM
Neverside Newbie
Status: Offline!
interesting interesting.. hey i'm learning!
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)