Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   PHP (http://www.programmingforums.org/forum29.html)
-   -   php script to find and list files.. (http://www.programmingforums.org/showthread.php?t=2675)

cloud- Mar 9th, 2005 8:14 AM

php script to find and list files..
 
i would like a little php script where from when it loads it gets the
files from he dir "Scripts" and if the extension is *.mrc
i want it to list the files as links with a box below with scroll bars. (like a code box)
so when i click on the link for the file it will add all the text from the file into the box below

can any one help me or have a link please
^_^

thanks alot

Pizentios Mar 9th, 2005 8:36 AM

www.php.net

or maybe try a search on google for php scripts.

big_k105 Mar 9th, 2005 10:05 AM

http://us4.php.net/function.opendir

i think this is the function and stuff you would use to do this :) good luck

Infinite Recursion Mar 9th, 2005 10:17 AM

What you are looking for is a little more restrictive than what I implemented at my site... but here is some code from an image PHP script I have... that will help you out a bit...

:

$imgDir = opendir(".");

while($imgName = readdir($imgDir)) {

  if (($imgName != ".") || ($imgName != ".."))
    print("<A HREF=\"$imgName\">$imgName</A><BR>\n");

  }


Dizzutch Mar 9th, 2005 8:55 PM

IR, php 5 supports !== which also tests for type, it's a nice extra check to make sure . and .. are not included, just a comment.

tempest Mar 9th, 2005 9:09 PM

!== is the not equal to strict evaluator, it makes sure that the boolean is evaluated without auto-cohersion, i'm confused... how is this used in the script?

Dizzutch Mar 9th, 2005 9:11 PM

if $fileName !== "."
I've used it and for some reason it worked better than != i forget why, i'll look into it.

Infinite Recursion Mar 9th, 2005 10:17 PM

Diz, I have PHP 4.x :)

Dizzutch Mar 10th, 2005 8:35 AM

fine, don't take my advise..:)

Infinite Recursion Mar 10th, 2005 1:33 PM

if it makes ya feel better I will be updating to 5 this weekend :) i'll change my script for ya then :)


All times are GMT -5. The time now is 6:25 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC