Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,156,798 members, 7,831,582 topics. Date: Friday, 17 May 2024 at 09:37 PM

Php Script - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Php Script (835 Views)

HELP - Installing A PHP Script On My Website Using GITHUB / Can Obfuscated Php Script Be Decoded? / I Need Help With A PHP Script (2) (3) (4)

(1)

Php Script by steepe(m): 2:31pm On Sep 25, 2007
Pls guys I need a PHP script that loops through a folder and also stores the contents of the files in the folder in an array
Re: Php Script by a3cube: 7:25pm On Oct 04, 2007
This is what U need I guess. I just wrote this code, U can correct any bug U see there.


<?
class readMyDIR{

function popArray($_v){
if(file_exists($_v)):
@$fileArray .= $_v.' ';
return @$fileArray;
endif;
}

function searchDir($fileType){
foreach (glob('*.'.$fileType) as $allFiles):
@$fileList .=  $this->popArray($allFiles);
endforeach;
return $fileList;
}

}

$myDir = new readMyDIR;
##__print the array
print_r($myDir->searchDir('txt')); //txt is the file extension U want to search for in the directory, you can try other extension too

echo '


';
##__do display as links use
$allFile = $myDir->searchDir('txt');
$eachFile = explode(',', str_replace(" ",",",rtrim($allFile)));
foreach($eachFile as $eachFile):
echo '<a href="'.$eachFile.'">'.$eachFile.'</a>
';
endforeach;
?>

(1)

Let Form A Java Programmers Club{{{ NEW}}} / Programmers Wealth Hive / Info Needed On Ict Infrastructure Training/certification In The Uk

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 5
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.