Experimental way to get the server name from wwwroot instead of

using such SERVER_NAME and HTTP_HOST variables.

It should help in servers having wrong Apache configurations, being
the cause of bad logins, referer problems....

Seems to work both under PHP 4.3 (linux) and PHP 5 (MacOS X).

Please, TEST it, specially in installation, upgrade and cron!
This commit is contained in:
stronk7 2005-02-28 09:04:37 +00:00
parent e889941458
commit b6e2260398

View File

@ -206,7 +206,13 @@ function get_referer() {
*/
function qualified_me() {
if (!empty($_SERVER['SERVER_NAME'])) {
global $CFG;
$url = parse_url($CFG->wwwroot);
if (!empty($url['host'])) {
$hostname = $url['host'];
} else if (!empty($_SERVER['SERVER_NAME'])) {
$hostname = $_SERVER['SERVER_NAME'];
} else if (!empty($_ENV['SERVER_NAME'])) {
$hostname = $_ENV['SERVER_NAME'];