RE: [PHP] Using PHP for directory indexing

2001-11-12 Thread Oosten, Sjoerd van

?
// print the current directory in unordered list
print(UL\n);

// open directory
$myDirectory = dir(.);

// get each entry
while($entryName = $myDirectory-read())
{
print(LI$entryName \n);
}

// close directory
$myDirectory-close();

print(/UL\n);
?


Sjoerd van Oosten 
Digitaal vormgever [EMAIL PROTECTED]
Datamex E-sites B.V. 
http://www.esites.nl
Minervum 7368 Telefoon: (076) 5 730 730 
4817 ZH BREDA Telefax: (076) 5 877 757 
___


-Oorspronkelijk bericht-
Van: Kevin Garrett [mailto:[EMAIL PROTECTED]]
Verzonden: maandag 12 november 2001 14:08
Aan: [EMAIL PROTECTED]
Onderwerp: [PHP] Using PHP for directory indexing


Hi All,

I am wondering if anyone can help me with this.  I want people
accessing my 
site to see a list of HTML reports but I don't want to turn on Directory 
indexing on my Apache webserver, seeing as the directory path is present.  
What I'm looking to do, is to write a basic php script which will read the 
files in a certain directory  create links to be presented to the user.  
Has anyone ever done this before?  Can someone give me an example or a 
headstart on this.

Thanks in advance
Kev

_
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Using PHP for directory indexing

2001-11-12 Thread Rudolf Visagie

function GetFiles ($DataPath, $files, $nfiles) {

// Reads a directory and puts filenames into a sorted array

$handle=opendir($DataPath);
if ($handle) {
$nfiles = -1;
while (false!==($file = readdir($handle))) {
if ($file != .  $file != ..) {
$nfiles++;
$files[$nfiles] = $file;
}
}
sort($files);
closedir($handle);
}
return 0;
}

Rudolf Visagie
Principal Software Developer
Digital Healthcare Solutions
Tel. +27(0)11 266 6946
Fax. +27(0)11 266 5080
Cell: +27(0)82 895 1598
E-mail: [EMAIL PROTECTED]


-Original Message-
From: Kevin Garrett [mailto:[EMAIL PROTECTED]]
Sent: 12 November 2001 03:08
To: [EMAIL PROTECTED]
Subject: [PHP] Using PHP for directory indexing


Hi All,

I am wondering if anyone can help me with this.  I want people
accessing my 
site to see a list of HTML reports but I don't want to turn on Directory 
indexing on my Apache webserver, seeing as the directory path is present.  
What I'm looking to do, is to write a basic php script which will read the 
files in a certain directory  create links to be presented to the user.  
Has anyone ever done this before?  Can someone give me an example or a 
headstart on this.

Thanks in advance
Kev

_
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Using PHP for directory indexing

2001-11-12 Thread Kevin Garrett


Wow that was a quick response...Thanks alot! That those the listing part of 
my problem but is there a way of only showing a certain type of file such as 
only HTML?   is there a way of somehow automatically making a link to 
access those pages?

From: Oosten, Sjoerd van [EMAIL PROTECTED]
To: 'Kevin Garrett' [EMAIL PROTECTED], '[EMAIL PROTECTED]'  
[EMAIL PROTECTED]
Subject: RE: [PHP] Using PHP for directory indexing
Date: Mon, 12 Nov 2001 14:15:14 +0100

?
   // print the current directory in unordered list
   print(UL\n);

   // open directory
   $myDirectory = dir(.);

   // get each entry
   while($entryName = $myDirectory-read())
   {
   print(LI$entryName \n);
   }

   // close directory
   $myDirectory-close();

   print(/UL\n);
?


Sjoerd van Oosten
Digitaal vormgever [EMAIL PROTECTED]
Datamex E-sites B.V.
http://www.esites.nl
Minervum 7368 Telefoon: (076) 5 730 730
4817 ZH BREDA Telefax: (076) 5 877 757
___


-Oorspronkelijk bericht-
Van: Kevin Garrett [mailto:[EMAIL PROTECTED]]
Verzonden: maandag 12 november 2001 14:08
Aan: [EMAIL PROTECTED]
Onderwerp: [PHP] Using PHP for directory indexing


Hi All,

   I am wondering if anyone can help me with this.  I want people
accessing my
site to see a list of HTML reports but I don't want to turn on Directory
indexing on my Apache webserver, seeing as the directory path is present.
What I'm looking to do, is to write a basic php script which will read the
files in a certain directory  create links to be presented to the user.
Has anyone ever done this before?  Can someone give me an example or a
headstart on this.

Thanks in advance
Kev

_
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


_
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Using PHP for directory indexing

2001-11-12 Thread Mike Harvey

Here's one from my function collection:
~~~
function list_dir($basedir,$type=,$filter=){
//echo $basedir;
 $handle=opendir($basedir);
 $filelisting=array();
 while ($file = readdir($handle)) {
  if ($file!=. AND $file!=..){
   switch($type){
case file:
 if(strstr($file,.))$filelisting[]=$file;
 break;
case dir:
 if(!strstr($file,.))$filelisting[]=$file;
 break;
default:
 $filelisting[]=$file;
   }
  }
 }
 closedir($handle);
 $out=$filelisting;
 if($filter!=){
  unset($out);
  $fcount=count($filelisting);
  $count=0;
  while($count=$fcount){
   if(strstr($filelisting[$count],$filter))$out[]=$filelisting[$count];
   $count++;
  }
 }
 sort($out);
 return $out;
}
~
$basedir - the directory you want to list
$type - optional -  will give you evything, file will give you all
files, dir will give you all directories
$filter - optional - allows you to specify a file type ie: gif
--
 Mike
~~~
   MICHAEL R. HARVEY Sculptor
   Web Creation - http://vestudiohost.com
   Internet Business Tools - http://ibiz-tools.com
   Sculpture, Craft, Jewelry - http://sculpture-by-mrh.com
http://jewelry-by-mrh.com http://craft-by-mrh.com
   New Product Innovations and Development. Ph: 845-279-8295
Rudolf Visagie [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 function GetFiles ($DataPath, $files, $nfiles) {

 // Reads a directory and puts filenames into a sorted array

 $handle=opendir($DataPath);
 if ($handle) {
 $nfiles = -1;
 while (false!==($file = readdir($handle))) {
 if ($file != .  $file != ..) {
 $nfiles++;
 $files[$nfiles] = $file;
 }
 }
 sort($files);
 closedir($handle);
 }
 return 0;
 }

 Rudolf Visagie
 Principal Software Developer
 Digital Healthcare Solutions
 Tel. +27(0)11 266 6946
 Fax. +27(0)11 266 5080
 Cell: +27(0)82 895 1598
 E-mail: [EMAIL PROTECTED]


 -Original Message-
 From: Kevin Garrett [mailto:[EMAIL PROTECTED]]
 Sent: 12 November 2001 03:08
 To: [EMAIL PROTECTED]
 Subject: [PHP] Using PHP for directory indexing


 Hi All,

 I am wondering if anyone can help me with this.  I want people
 accessing my
 site to see a list of HTML reports but I don't want to turn on Directory
 indexing on my Apache webserver, seeing as the directory path is present.
 What I'm looking to do, is to write a basic php script which will read the
 files in a certain directory  create links to be presented to the user.
 Has anyone ever done this before?  Can someone give me an example or a
 headstart on this.

 Thanks in advance
 Kev

 _
 Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]