NameSilo

Folder Reader

SpaceshipSpaceship
Watch

Mystic

Account Closed
Impact
8
i am using this script to pickup folder names and make hyperlinks to foldername/index.php but no matter what i do, it seems to pick root folders up, i want it to pick folders up that are in the /pages directory, automatically anyone know whats wrong? or can reccomend a file that auto detects phpfiles/scripts ?

Code:
<?
$rep=opendir('.');
$bAuMoinsUnRepertoire = false;
while ($file = readdir($rep)){
	if($file != '..' && $file !='.' && $file !=''){ 
		if (is_dir($file)){
			print("<a href='$file/index.php'>$file</a>");
			print("<BR>");
		}
	}
}
{
}


?>
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
*bump*
 
0
•••
That's because you're telling it to open the root folder with the dot. To have it open a folder outside of the directory that the script resides in you would need to addd the full path to the opendir function such as:

$rep = opendir('/full/path/to/pages/dir');

You would need to loop through the directories or something similar to read more than one directory at a time. You could read the all the directories into an array and then loop through the array and perform the function on each directory and there's all sorts of other ways you could do it I'm sure.
 
0
•••
is this what you meant? do that? as this aint working

Code:
<?
$rep = opendir('C:\Program Files\EasyPHP1-8\www\pages\');
$bAuMoinsUnRepertoire = false;
while ($file = readdir($rep)){
	if($file != 'C:\Program Files\EasyPHP1-8\www\pages\' && $file !='.' && $file !=''){ 
		if (is_dir($file)){
			print("<a href='$file/index.php'>$file</a>");
			print("<BR>");
		}
	}
}
{
}


?>

or

Code:
<?
$rep = opendir('C:\Program Files\EasyPHP1-8\www\pages\');
$bAuMoinsUnRepertoire = false;
while ($file = readdir($rep)){
	if($file != '.' && $file !='.' && $file !=''){ 
		if (is_dir($file)){
			print("<a href='$file/index.php'>$file</a>");
			print("<BR>");
		}
	}
}
{
}


?>
both wont work
 
0
•••
Dynadot — .com TransferDynadot — .com Transfer
Appraise.net

We're social

Escrow.com
Spaceship
Rexus Domain
CryptoExchange.com
Domain Recover
CatchDoms
DomDB
NameFit
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back