$_SERVER['SERVER_NAME'] writable !

From: Vincent M. (cult_at_free.fr)
Date: 04/29/04


Date: Thu, 29 Apr 2004 14:12:46 +0200

Hello,

I am using the variable $_SERVER['SERVER_NAME'] inside a function, for
example:

function check_servname() {
   global $server ;
   if($_SERVER['SERVER_NAME'] != $server) {
      echo "NOT OK, NOT GOOD SERVER NAME" ;
      exit ;
    }
}

But we can modify the value of $_SERVER['SERVER_NAME'] before calling
the function check_servname(). And I am looking for a the right server
name not for a server name which may have been changed before calling
check_servername:
$_SERVER['SERVER_NAME'] = "www.google.com" ; //before calling
check_servname and $_SERVER['SERVER_NAME'] will be "www.google.com"
inside the function even the server name is not "www.google.com".

Is there any way to get the server name with a variable which would be
read-only ?

Thanks,
Vincent.