crazy script prints variable value from other scripts?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • squash@peoriadesignweb.com

    crazy script prints variable value from other scripts?

    I have spent two hours trying to make sense of this script, called
    crazy.php. The output should be nothing because $cookie_passwor d is
    nowhere defined in this script, correct? But it actually outputs the
    value that other scripts i have running set it to. Why should crazy.php
    care what other scripts are running that use that variable name??


    <?php

    crazy();

    ////////////////////////////

    function crazy() {

    global $cookie_passwor d;

    echo $cookie_passwor d;

    } // end function

    ?>

  • Jerry Stuckle

    #2
    Re: crazy script prints variable value from other scripts?

    squash@peoriade signweb.com wrote:
    I have spent two hours trying to make sense of this script, called
    crazy.php. The output should be nothing because $cookie_passwor d is
    nowhere defined in this script, correct? But it actually outputs the
    value that other scripts i have running set it to. Why should crazy.php
    care what other scripts are running that use that variable name??
    >
    >
    <?php
    >
    crazy();
    >
    ////////////////////////////
    >
    function crazy() {
    >
    global $cookie_passwor d;
    >
    echo $cookie_passwor d;
    >
    } // end function
    >
    ?>
    >
    Are you including this script in another one?

    Do you have register_global s set to on?

    --
    =============== ===
    Remove the "x" from my email address
    Jerry Stuckle
    JDS Computer Training Corp.
    jstucklex@attgl obal.net
    =============== ===

    Comment

    • squash@peoriadesignweb.com

      #3
      Re: crazy script prints variable value from other scripts?

      Jerry Stuckle wrote:
      Are you including this script in another one?
      nope, the script is just being run alone. it is not included from
      anywhere
      Do you have register_global s set to on?
      i am on a shared host and did a phpinfo and got this:

      register_global s On On

      so that must be it!

      Comment

      • Jerry Stuckle

        #4
        Re: crazy script prints variable value from other scripts?

        squash@peoriade signweb.com wrote:
        Jerry Stuckle wrote:
        >
        >>Are you including this script in another one?
        >
        >
        nope, the script is just being run alone. it is not included from
        anywhere
        >
        >
        >>Do you have register_global s set to on?
        >
        >
        i am on a shared host and did a phpinfo and got this:
        >
        register_global s On On
        >
        so that must be it!
        >
        Get another host. I wouldn't trust any host who runs with it on.

        --
        =============== ===
        Remove the "x" from my email address
        Jerry Stuckle
        JDS Computer Training Corp.
        jstucklex@attgl obal.net
        =============== ===

        Comment

        Working...