$PHP_SELF=$_SERVER["PHP_SELF"]; if (preg_match("/(.*)edit\/([[:alnum:]]{1,}.php{1})/",$_SERVER["SCRIPT_FILENAME"],$regs)){ $admin_dir=1; $site_root=$regs[1]; $relative_path_str="../"; } else if (preg_match("/(.*)\/([[:alnum:]]{1,}.php{1})/",$_SERVER["SCRIPT_FILENAME"],$regs)) $site_root=$regs[1]; else if ($debug) echo "Go to stat.inc and set up manually."; if (preg_match("/(([[:alnum:]\/_~]){0,})(index.php{1})/",$PHP_SELF,$regs)) $site_url=$_SERVER["HTTP_HOST"].$regs[1]; if (preg_match("/(([[:alnum:]\/_~]){0,})(edit\/{1})(index.php{1})/",$PHP_SELF,$regs)) $site_url=$HOSTNAME.$regs[1];