Page 1 of 1

Accesing an image for a subdomain

Posted: Wed Jul 09, 2008 5:26 am
by Rovas
I have a server that a site domain and 2 subdomains, the PHP code plus the rest of the files used to "make" sits in a single directory called Core.
The problem is that: a script that reads and outputs images from Core doesn' t work in the subdomains. None of the error messages put in the file appear when I call for the file. I read about how the subdomains consider the absolute paths as starting from their directories, only links to other domains or subdomains work but I can use that.
The script is a simple one:

Code: Select all

 
         trace(__FILE__);
    if(!isset($_GET['file'])) {echo ( 'missing param file');}
    $path=$_SERVER['DOCUMENT_ROOT']'/img/'.$_GET['file'];
        // the onlyext is a function that extracts the extension from a given path
    header ("Content-Type:image/".onlyext($path));
    $msg='Canget. File not found:'.$path;   
    if (!is_file($path)) echo ( "$path file not found in canget." );
    $file_extension = onlyext($path);
        switch( $file_extension ) {
             case "php":
             case "py":
             echo ("Try to get a file of $file_extension type is not permitted");   
             break;
        }
    readfile($path);
 

Re: Accesing an image for a subdomain

Posted: Wed Jul 09, 2008 4:16 pm
by Benjamin
duplicate thread: viewtopic.php?f=1&t=85226