function load_config() { global $config; $file = normpath(dirname(__FILE__) . '/config.php'); if (file_exists($file)) { include_once $file; } // load outer config file $file = normpath(dirname(__FILE__) . '/../../config.php'); if (file_exists($file)) { include_once $file; } return $config; }
//dir of init.php $sessbase = "{$base}/sessions"; /* writeable from www user */ $servername = $_SERVER['SERVER_NAME']; $scriptname = $_SERVER['SCRIPT_NAME']; //for scripts including init.php from inside php/ directory: if (basename($scriptdir) == "php") { $scriptdir = preg_replace("/\\/php\$/", "", $scriptdir); } if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") { $prot = "https"; } else { $prot = "http"; } if ($avsswwwdir == "") { $avsswwwdir = "/"; } //installed under / $avsswwwdir = normpath(dirname(substr(__FILE__, strlen($_SERVER['DOCUMENT_ROOT']))) . '/../'); $wscriptdir = "{$prot}://{$servername}{$avsswwwdir}"; if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) { $remaddr = $_SERVER['HTTP_X_FORWARDED_FOR']; } else { $remaddr = $_SERVER['REMOTE_ADDR']; } //login $authstatus = 1; if (!$authstatus) { echo "not logged in"; exit; }