Undefined variables
| From: | Uri Even-Chen | Date: | Wed, 04 Jul 2001 15:12:11 +0000 |
| Subject: | Undefined variables | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-56182@lists.php.net to get a copy of this message | ||
To PHP-general group,
I have configured PHP to report all errors & warnings ("error_reporting
= E_ALL" on php.ini file), but since then I get tons of warning
messages for "Undefined variables". For example, referring $HTTP_HOST
directly leads a message like "Undefined variable: HTTP_HOST in ... on
line ...". I tried to use $HTTP_SERVER_VARS['HTTP_HOST'] instead, but
then I get the message "Undefined index: HTTP_HOST in ... on line ...".
How do I get rid of these messages? I also get these messages for
internal variables, cookie variables (globals) etc.
I am also interested in testing whether the user typed the URL properly,
including upper/lower case. I'm using this code to check it in the
beginning of the page:
<?php
if (strcmp($HTTP_SERVER_VARS['HTTP_HOST'], 'dating.speedy.co.il') != 0)
{
header('Location: http://dating.speedy.co.il/');
exit;
}
?>
But, if the user enters <http://DATING.SPEEDY.CO.IL/>, this has no
effect. Is there any way to get a case sensitive version of HTTP_HOST?
(I noticed HTTP_HOST has changed since the previous version of PHP &
apache).
Thanks,
Uri Even-Chen
Speedy Software
Raanana, Israel.
--------------------------------------------------------
Welcome to Speedy Net (In Hebrew):
http://www.speedy.co.il/
Speedy Dating (In Hebrew):
http://dating.speedy.co.il/
Speedy Composer (In English):
http://www.speedy.co.il/composer/
--------------------------------------------------------