For some reasons, I have to use auto_prepend_file
(http://php.net/manual/en/ini.core.php#ini.auto-prepend-file) to load a var.php
file with some variables. But I can see that some variables like $_SERVER['HTTP_USER_AGENT']
doesn't work except when I'm on the file that's called.
If I go to the index.php
, the variable is empty. Is it possible to get around this?
Seems that designed behavior. Try to store this vars somewhere in prepend file and then load.
I have check php.manual, no words about this, but try.
What it will output:
<?php
phpinfo(32);
?>
Also:
Be warned that most contents of the Server-Array (even $_SERVER['SERVER_NAME']) are provided by the client and can be manipulated. They can also be used for injections and thus MUST be checked and treated like any other user input.