Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Feb 2006
    Posts
    262
    Thanks
    23
    Thanked 1 Time in 1 Post

    Post read dir on another sub-domain under same domain

    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 ?

    PHP Code:
    <?


    $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 ){

    $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 ) );
                
    // Just to add spacing to the list, to better
                // show the directory tree.
                
                
    $restq substr($fileq0, -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.'/'.$fileqFalse).'</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 !

  • #2
    Mega-ultimate member
    Join Date
    Jun 2002
    Location
    Winona, MN - The land of 10,000 lakes
    Posts
    1,855
    Thanks
    1
    Thanked 45 Times in 42 Posts
    My guess is if they have the server configured to block you with FTP access, they also have PHP configured to not allow you to read directories not owned by your account.

    Sounds like something you need to work out with your host.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •