$_SERVER['SERVER_NAME'] in read-only.
| From: | Vincent M. | Date: | Thu, 29 Apr 2004 12:19:32 +0000 |
| Subject: | $_SERVER['SERVER_NAME'] in read-only. | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-184939@lists.php.net to get a copy of this message | ||
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.