read dir on another sub-domain under same domain
Posted: Fri Jan 04, 2008 7:04 pm
Good day to you all and healthy 2008,
I"m working on a photograph site. The server don't allow me to have a restricted ftp access so they gave me another sub-domain.
My question is how can I set the following script to read on another sub-domain which both are under the same domain ?
Thanks for any help someone could give !
HAve a great one !
I"m working on a photograph site. The server don't allow me to have a restricted ftp access so they gave me another sub-domain.
My question is how can I set the following script to read on another sub-domain which both are under the same domain ?
Code: Select all
<?
$nomfile = $_POST["nomfile"];
$bob = $_POST["bob"];
function CountDirq($qDir, $qRecurse)
{
$Countq = 0;
$dq = dir($qDir);
while ($Entry = $dq->Read())
{
if (!(($Entry == "..") || ($Entry == ".")))
{
if (Is_Dir($qDir . '/' . $Entry))
{
if ($qRecurse)
{
$Countq += CountDirq($qDir . '/' . $Entry, $qRecurse);
}
}
else
{
$Countq++;
}
}
}
return $Countq;
}
echo '<textarea rows="1" cols="50" id="pmenu" name="pmenu" wrap="off" >';
function getDirectorya( $pathq = '.', $level = 0 ){
$myFileq = "http://domain-A.com/Sidebar_icon/icon_change.txt";
$fhq = fopen($myFileq, 'r');
$outputtq = fgets($fhq);
$outputq = str_replace("../..", "http://domain-A.com/", $outputtq );
fclose($fhq);
$ignoreq = array( 'cgi-bin', '.', '..' );
// Directories to ignore when listing output. Many hosts
// will deny PHP access to the cgi-bin.
$dhq = @opendir( $pathq );
// Open the directory to the handle $dh
while( false !== ( $fileq = readdir( $dhq ) ) ){
// Loop through the directory
if( !in_array( $fileq, $ignoreq ) ){
// Check that this file is not to be ignored
$spacesq = str_repeat( 'f', ( $level * 4 ) );
// Just to add spacing to the list, to better
// show the directory tree.
$restq = substr($fileq, 0, -4);
if( is_dir( "$pathq/$fileq" ) ){
// Its a directory, so we need to keep reading down...
echo '<a href="images.php?folder='.$pathq.'/'.$fileq.'" class="blue0"> '.$spacesq.' <img src="'.$outputq.'" border="0" /> '.$fileq.'- '.CountDirq($pathq.'/'.$fileq, False).'</a>';
getDirectorya( "$pathq/$fileq", ($level+1) );
// Re-call this same function but on a new directory.
// this is what makes function recursive.
} else {
// Just print out the filename
}
}
}
closedir( $dhq );
// Close the directory handle
}
getDirectorya( "http://another-domain-or-sub-domain.net" );
// Get contents of the "files/includes" folder
?>Thanks for any help someone could give !
HAve a great one !