need help with DOCUMENT_ROOT

Discussion in 'PHP' started by gclass, Jul 16, 2009.

  1. #1
    Hello,

    I am using Extplorer and want it to access only the folder its installed in and the folder's subdirectories.

    my server home dir is /home/USER/public_html

    Help is welcomed.

    Thanks


    here is the code:
    
    // the filename of the eXtplorer script: (you rarely need to change this)
    if($_SERVER['SERVER_PORT'] == 443 ) {
    	$GLOBALS["script_name"] = "https://".$GLOBALS['__SERVER']['HTTP_HOST'].$GLOBALS['__SERVER']["PHP_SELF"];
    	$GLOBALS['home_url'] = "https://".$GLOBALS['__SERVER']['HTTP_HOST'].dirname($GLOBALS['__SERVER']["PHP_SELF"]);
    }
    else {
    	$GLOBALS["script_name"] = "http://".$GLOBALS['__SERVER']['HTTP_HOST'].$GLOBALS['__SERVER']["PHP_SELF"];
    	$GLOBALS['home_url'] = "http://".$GLOBALS['__SERVER']['HTTP_HOST'].dirname($GLOBALS['__SERVER']["PHP_SELF"]);
    }
    $GLOBALS['home_url'] = str_replace( '/administrator', '', $GLOBALS['home_url'] );
    $GLOBALS['home_dir'] = !empty( $_SERVER['DOCUMENT_ROOT'] ) ? $_SERVER['DOCUMENT_ROOT'] : '.';
    
    // Important Definitions!
    define ( "_EXT_PATH", realpath(dirname( __FILE__ ).'/..') );
    define ( "_EXT_FTPTMP_PATH", realpath( dirname( __FILE__ ).'/../ftp_tmp') );
    if( function_exists( 'mosGetParam') || class_exists( 'jconfig')) {
    	define ( "_EXT_URL", $GLOBALS['home_url']."/administrator/components/com_extplorer" );
    } else {
    	define ( "_EXT_URL", dirname($GLOBALS['script_name']) );
    }
    
    require_once( _EXT_PATH . '/application.php' );
    require_once( _EXT_PATH.'/include/functions.php' );
    
    PHP:
     
    gclass, Jul 16, 2009 IP
  2. gclass

    gclass Active Member

    Messages:
    337
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    55
    #2
    by replacing :
    
    $GLOBALS['home_dir'] = !empty( $_SERVER['DOCUMENT_ROOT'] ) ? $_SERVER['DOCUMENT_ROOT'] : '.';
    PHP:
    with:

    $GLOBALS['home_dir'] = (dirname(__FILE__).'/..');
    PHP:
    maybe it will help someone else in the fuutre..
     
    gclass, Jul 17, 2009 IP
  3. kichus

    kichus Peon

    Messages:
    188
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks kobitriki

    It helped me I was getting "home directory doesn't exist, check your settings" error.
     
    kichus, Nov 5, 2009 IP
  4. AlphaBillion

    AlphaBillion Peon

    Messages:
    24
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Good to see you solve your issue
     
    AlphaBillion, Nov 5, 2009 IP