Quick Search:
Oracle PL/SQL Code Library
Find Or Post Oracle Jobs
Oracle Discussion & Chat
 PHP Code: Fix missing $_SERVER SCRIPT_URL variable Jump to:  
Category: >> PHP Code >> Fix missing $_SERVER SCRIPT_URL variable Bookmark and Share

<< lastnext >>

Snippet Name: Fix missing $_SERVER SCRIPT_URL variable

Description: Many scripts rely on $_SERVER[SCRIPT_URL] which is sometimes missing. This function detects it from other server variables and fixes the missing field.

Also see:
» Read GET URL Variables Into An Associa...
» Fix missing $_SERVER SCRIPT_URL variab...
» Checking Server Status with PHP
» Declaring Variables
» Call subroutine and pass variable by v...
» SEQUENCE: get sequence value into vari...
» Anonymous blocks - Constants and Varia...
» GET and POST variables in hidden form
» Variable Speed Horiz Scroll
» Get file in as variable

Comment: (none)

Language: PHP
Highlight Mode: PHP
Last Modified: March 16th, 2009

 * Tries to determine Servers' SCRIPT_URL, if it doesn't exist.
 * The missing superglobal $_SERVER array element will be fixed.
 * Example: client requests ... 
 * http://www.hostname.com/testpage.html?param=value&foo=bar
 * ...$_SERVER['SCRIPT_URL'] is (or becomes)
 * "/testpage.html"
FUNCTION get_script_url() 
    $script_url = NULL;
        $script_url = $_SERVER['SCRIPT_URL'];
        $script_url = $_SERVER['REDIRECT_URL'];
        $p = PARSE_URL($_SERVER['REQUEST_URI']);
        $script_url = $p['path'];
    ELSE DIE (__FILE__." / ".__FUNCTION__.':<br />Couldn\'t determine $_SERVER["SCRIPT_URL"].');
    $_SERVER['SCRIPT_URL'] = $script_url;
    return $script_url;
} // get_script_url()

Oracle Magazine
and Oracle White Papers

SQL University.net courses meet the most demanding needs of the business world for advanced education in a cost-effective manner. SQL University.net courses are available immediately for IT professionals and can be taken without disruption of your workplace schedule or processes.

Compared to traditional travel-based training, SQL University.net saves time and valuable corporate resources, allowing companies to do more with less. That's our mission, and that's what we deliver.

Click here to find out more
Home      :      Code Library      :      Sponsors      :      Privacy      :      Terms of Use      :      Contact Us 22 users online    © 2009 psoug.org

Forgot your password?