Adjusting behavior based on an environment variable : _SERVER « Form « PHP






Adjusting behavior based on an environment variable

 
<?php
$version = $_SERVER['SITE_VERSION'];

if ('members' == $version) {
    if (!authenticate_user($_POST['username'], $_POST['password'])) {
        header('Location: http://guest.example.com/');
        exit;
    }
}
include_once "${version}_header"; // load custom header
  
  








Related examples in the same category

1.$_SERVER extracts valuable server- and script-related information
2.Deciding what to do based on request method
3.Log use IP address
4.Getting Times and Dates of Files: $_SERVER['SCRIPT_FILENAME']
5.PHP $_SERVER Arguments
6.superglobal variables
7.Output file time
8.Some Common $_SERVER Elements