Go back to your original post and you will see you were trying to access a SERVER variable that did not exist.
This showed that you did not know what you were doing.
The dump of SERVER variables you made now shows you all of the variables you can pick from, you can read them, echo them out onto the screen or use them to make strings for links etc.
You can do that var_dump($_SERVER) on any page you are developing on when you want to check which variables apply to that particular page.
Its really useful, its only one line, and you can comment it out or remove it before you publish the webpage -- in fact you MUST -- it contains lots of information that would be of interest to a potential cracker.
So now to return to the points made earlier in this thread you can edit that server.php page slightly and then compare the output of the following:
server.php
PHP Code:
<?php
// comment out that readout, maybe uncomment it later ... else remove these lines
//echo 'These are your SERVER variables available from every script <hr />';
//var_dump($_SERVER);
echo "The host for this site is " . $_SERVER['HOST'] . '<hr />';
echo "This exact script is " . $_SERVER['SCRIPT_FILENAME'] . '<hr />';
echo "The __FILE__ variable for this exact script is " . __FILE__ . '<hr />';
// now create some conditional messages depending on one of those variables ...
if($_SERVER['SCRIPT_FILENAME'] === "server.php"){
echo 'You have found the server vars page';
}else{
echo 'This is not the server vars page';
}
?>
Bookmarks