15-server_variables/index.php File Reference

This program is used to demonstrate use of SERVER variables provided by apache to PHP interpreter. More...

Go to the source code of this file.

Functions

 get_server ($var1)
 This function looks for given variable in server variables.
 print_variable ($var1)
 This function echoes or prints list items for given server variable.
 show_server_page ()
 This function displays HTML page with values of various server variables to demonstrate information about client / server that is available to PHP interpreter.

Variables

 $server_variables
 This array is used to store list of server variables to be displayed.


Detailed Description

This program is used to demonstrate use of SERVER variables provided by apache to PHP interpreter.

We can use these variables to get information about current client or server.

Author:
Saurabh Barjatiya
Version:
1.0

Definition in file index.php.


Function Documentation

get_server ( var1  ) 

This function looks for given variable in server variables.

If variable if found its value is returned else empty string "" is returned.

Parameters:
var1 Variable to be looked in SERVER variables array.
Returns:
Value of given variable from $_SERVER array or empty string

Definition at line 35 of file index.php.

Referenced by get_remote_address(), and print_variable().

print_variable ( var1  ) 

This function echoes or prints list items for given server variable.

This make generation of list very easy.

Parameters:
var1 Name of server variable for which list item should be echoed.
Returns:
Nothing

Definition at line 78 of file index.php.

References get_server().

Referenced by show_server_page().

show_server_page (  ) 

This function displays HTML page with values of various server variables to demonstrate information about client / server that is available to PHP interpreter.

Returns:
Nothing.

Definition at line 49 of file index.php.

References $server_variables, and print_variable().


Variable Documentation

$server_variables

Initial value:

array(
        'HTTP_HOST',
        'HTTP_USER_AGENT',
        'HTTP_ACCEPT_ENCODING',
        'HTTP_CONNECTION',
        'HTTP_REFERER',
        'HTTP_COOKIE',
        'SERVER_SIGNATURE',
        'DOCUMENT_ROOT',
        'REMOTE_ADDR',
        'REMOTE_PORT',
        'SCRIPT_FILENAME',
        'REQUEST_URI',
        'SCRIPT_NAME'
    )
This array is used to store list of server variables to be displayed.

Definition at line 12 of file index.php.

Referenced by show_server_page().


Generated on Fri Nov 4 14:16:55 2011 for PHP example documentation by  doxygen 1.4.7