parameters in URL not readable

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • geoff.houdmont@gmail.com

    parameters in URL not readable

    Hi,

    I transfered one of my websites to another provider because I was asked
    to do that.
    The problem I have is it seems like the parameters after the ? are not
    readable in the page.
    Whereever I make an echo on that page there is nothing happening.
    php 5.0.5 is on the server

    Is there anyone who can help me?

    Best regards,

    Geoff

  • Rik

    #2
    Re: parameters in URL not readable

    geoff.houdmont@ gmail.com wrote:
    Hi,
    >
    I transfered one of my websites to another provider because I was
    asked to do that.
    The problem I have is it seems like the parameters after the ? are not
    readable in the page.
    Whereever I make an echo on that page there is nothing happening.
    php 5.0.5 is on the server
    >
    Is there anyone who can help me?
    Check register_global s, and print_r($_GET).
    Are they there?
    --
    Rik Wasmus


    Comment

    • geoff.houdmont@gmail.com

      #3
      Re: parameters in URL not readable

      >
      Check register_global s, and print_r($_GET).
      Are they there?
      --
      Rik Wasmus
      Yes it is there.

      Geoff

      Comment

      • Rik

        #4
        Re: parameters in URL not readable

        geoff.houdmont@ gmail.com wrote:
        >Check register_global s, and print_r($_GET).
        >Are they there?
        >
        Yes it is there.
        PHP is a popular general-purpose scripting language that powers everything from your blog to the most popular websites in the world.

        --
        Rik Wasmus


        Comment

        • Geoff

          #5
          Re: parameters in URL not readable


          Rik wrote:
          geoff.houdmont@ gmail.com wrote:
          Check register_global s, and print_r($_GET).
          Are they there?
          Yes it is there.
          >
          PHP is a popular general-purpose scripting language that powers everything from your blog to the most popular websites in the world.

          --
          Rik Wasmus
          Is there a way to get a fast solution?
          otherwise i have to change a lot.

          Comment

          • Rik

            #6
            Re: parameters in URL not readable

            Geoff wrote:
            Rik wrote:
            >geoff.houdmont@ gmail.com wrote:
            >>>Check register_global s, and print_r($_GET).
            >>>Are they there?
            >>>
            >>Yes it is there.
            >>
            >http://www.php.net/manual/en/securit...terglobals.php
            >
            Is there a way to get a fast solution?
            otherwise i have to change a lot.
            I urge you to fix this, but in the mean while:
            extract($_GET);
            --
            Rik Wasmus


            Comment

            • Geoff

              #7
              Re: parameters in URL not readable

              >
              I urge you to fix this, but in the mean while:
              extract($_GET);
              --
              Rik Wasmus
              What is the new way to do this?
              I've read through the link you gave me but it isn't completely clear to
              me.

              Geoff

              Comment

              • Rik

                #8
                Re: parameters in URL not readable

                Geoff wrote:
                >I urge you to fix this, but in the mean while:
                >extract($_GET) ;
                What is the new way to do this?
                I've read through the link you gave me but it isn't completely clear
                to me.
                1. All variables from a GET request are in the $_GET-array. This will make
                sure that they don't 'infect' used variables.
                2. When using a $_GET variable, first make sure it's a type you expect.
                (for instance:
                $id = intval($_GET['id']);//make sure it's an integer
                $name = preg_replace('/^[a-z0-9]/i','',$_GET['name']);//only
                alphanumeric characters)
                3. Use validated variables as you would like.


                The main reason is that (sloppy) code with uninitialized variables can be
                influenced with either GET or POST request resulting in unexpected and/or
                undesireable results. Alwaus make sure you:
                a: initiliaze all variables.
                b: no outside variables are used for anything without a proper type-check
                first.
                --
                Grtz,

                Rik Wasmus


                Comment

                • Geoff

                  #9
                  Re: parameters in URL not readable

                  Thank you

                  Rik wrote:
                  Geoff wrote:
                  I urge you to fix this, but in the mean while:
                  extract($_GET);
                  What is the new way to do this?
                  I've read through the link you gave me but it isn't completely clear
                  to me.
                  >
                  1. All variables from a GET request are in the $_GET-array. This will make
                  sure that they don't 'infect' used variables.
                  2. When using a $_GET variable, first make sure it's a type you expect.
                  (for instance:
                  $id = intval($_GET['id']);//make sure it's an integer
                  $name = preg_replace('/^[a-z0-9]/i','',$_GET['name']);//only
                  alphanumeric characters)
                  3. Use validated variables as you would like.
                  >
                  >
                  The main reason is that (sloppy) code with uninitialized variables can be
                  influenced with either GET or POST request resulting in unexpected and/or
                  undesireable results. Alwaus make sure you:
                  a: initiliaze all variables.
                  b: no outside variables are used for anything without a proper type-check
                  first.
                  --
                  Grtz,
                  >
                  Rik Wasmus

                  Comment

                  • Chuck Anderson

                    #10
                    Re: parameters in URL not readable

                    Geoff wrote:
                    >I urge you to fix this, but in the mean while:
                    >extract($_GET) ;
                    >--
                    >Rik Wasmus
                    >>
                    >
                    What is the new way to do this?
                    I've read through the link you gave me but it isn't completely clear to
                    me.
                    >
                    Geoff
                    >
                    >
                    Quick and dirty:

                    Use a text editor to include a script at the very beginning of every php
                    file:

                    <?php
                    include 'extractor.php' ;
                    ?>

                    Put this in extractor.php

                    <?php
                    if (is_array($_GET ))
                    {
                    foreach ($_GET as $xxkey =$xxvalue)
                    {
                    $$xxkey = $xxvalue;
                    }
                    }
                    ?>

                    (Note: 'xx' is added to the var name to try and keep the var names
                    unique, otherwise, if you have passed a GET variable with the same name
                    ($key or $value), it would be overwritten by the next iteration of the
                    foreach.)

                    This should get you working, but then I advise you to go back and add
                    some real injection prevention functions at the beginning of routines
                    that need them.

                    --
                    *************** **************
                    Chuck Anderson • Boulder, CO

                    *************** **************

                    Comment

                    • Colin Fine

                      #11
                      Re: parameters in URL not readable

                      Chuck Anderson wrote:
                      Geoff wrote:
                      >>I urge you to fix this, but in the mean while:
                      >>extract($_GET );
                      >>--
                      >>Rik Wasmus
                      >>>
                      >>
                      >What is the new way to do this?
                      >I've read through the link you gave me but it isn't completely clear to
                      >me.
                      >>
                      >Geoff
                      >>
                      >>
                      Quick and dirty:
                      >
                      Use a text editor to include a script at the very beginning of every php
                      file:
                      >
                      <?php
                      include 'extractor.php' ;
                      ?>
                      >
                      Put this in extractor.php
                      >
                      <?php
                      if (is_array($_GET ))
                      {
                      foreach ($_GET as $xxkey =$xxvalue)
                      {
                      $$xxkey = $xxvalue;
                      }
                      }
                      ?>
                      >
                      (Note: 'xx' is added to the var name to try and keep the var names
                      unique, otherwise, if you have passed a GET variable with the same name
                      ($key or $value), it would be overwritten by the next iteration of the
                      foreach.)
                      >
                      This should get you working, but then I advise you to go back and add
                      some real injection prevention functions at the beginning of routines
                      that need them.
                      >
                      This looks to me like a clumsy way of emulating 'extract($_GET) ', as
                      suggested by Rik. Are you claiming some advantage to doing it this way?

                      Colin

                      Comment

                      Working...