PHP not detecting parameter values in URL

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dis-6066
    Junior Member
    • Mar 2006
    • 4

    PHP not detecting parameter values in URL

    On all of my domains hosted here, all PHP files suddenly lost their ability to
    detect the values of parameters given in the url. Does anyone know why? Thank you. -- Mike Lepore

    examples:

    ------------------------------------------------------------------
    listing of http://www.crimsonbird.com/xyz/test6.php
    ------------------------------------------------------------------

    <html><head><title>test page</title></head><body><p>

    <?php
    if ($param == "xyz") {echo "hello";}
    else {echo "goodbye";}
    ?>

    </p></body></html>

    ------------------------------------------------------------------
    program results:
    ------------------------------------------------------------------

    url:

    output:
    goodbye

    url:

    output:
    goodbye

    ------------------------------------------------------------------
    listing of http://www.crimsonbird.com/xyz/test7.php
    ------------------------------------------------------------------

    <html><head><title>test page</title></head><body>
    <p>

    <?php
    echo ("The value of the parameter is $param");
    ?>

    </p>
    </body></html>


    ------------------------------------------------------------------
    program results:
    ------------------------------------------------------------------

    url:

    output:
    The value of the parameter is
  • AndrewT
    Administrator
    • Mar 2004
    • 3653

    #2
    This is because you are depending on register_globals being enabled, which it is not by default on new servers. This is generally considered poor programming practice and can easily lead to insecure code.

    You should access your GET variables using $_GET["param"] and your POST variables using $_POST["param"] instead.

    Having said that, if you need register_globals enabled you can still enable it. This was noted in your server's upgrade thread:

    Also, if your scripts require PHP's register_globals to be enabled, you will need to create a php.ini file in the exact directory of the script that requires the setting with the following line in it:

    register_globals = On

    Comment

    Working...