php globals

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • FI2C
    Junior Member
    • Mar 2004
    • 2

    #1

    php globals

    can we (as a reseller) have control on register_globals on/off in php?
    any good refference for clients that have problem with that?
  • Jonathan
    Senior Member
    • Mar 2004
    • 1229

    #2
    I think Globals are on;
    I try to avoid them, though, as they present huge security issues.

    Note; exact security issues, unknown; just remember a friend telling me this.
    "How can someone be so distracted yet so focused?"
    - C

    Comment

    • -Oz-
      Senior Member
      • Mar 2004
      • 545

      #3
      It is on, the security issues involve people using urls to pass information to databases that could potentially damage your data.
      Dan Blomberg

      Comment

      • Thyme
        Junior Member
        • Mar 2004
        • 13

        #4
        Just beacuse it's on doesn't mean you have to code them. Use the $_POST[], $_GET[], $_SESSION[], etc. assoc. arrays instead of globals and you shouldn't have any security problems even with the setting on.
        "I have never made but one prayer to God, a very short one: 'O, Lord, make my enemies ridiculous.' And God granted it." --Voltaire

        Comment

        • Buddha
          Senior Member
          • Mar 2004
          • 825

          #5
          Originally posted by -Oz-
          It is on, the security issues involve people using urls to pass information to databases that could potentially damage your data.
          Oz, I think your confusing two seperate issues "Variable Substitution" and "SQL Injection Attacks."

          To defeat variable substitution:
          Always initialize your variables. This can be harder than it sounds if you have variables all over the place. So keep your variables organized.
          Use GPC globals as Thyme suggested.

          To defeat SQL injection attacks:
          Validate user input. If a user input requires at max a ten digit number make sure that's what you get.
          Check for nasty words like "SELECT" or "DELETE."
          Learn to live with Magic_Quotes.
          Limit user access. Your common user doesn't need "INSERT" rights to your pricing table.

          Here's an article to get you started: http://www.zend.com/zend/art/art-oertli.php
          "Whatcha mean I shouldn't be rude to my clients?! If you want polite then there will be a substantial fee increase." - Buddha

          Comment

          • -Oz-
            Senior Member
            • Mar 2004
            • 545

            #6
            Thanks for the info, I will definitely read that article.
            Dan Blomberg

            Comment

            • Denver Dave
              Member
              • Sep 2004
              • 49

              #7
              Looks like Register Globals is now set to off as of today. Is there a php command to over-ride this if necessary rather than dealing with each and every variable name?

              Comment

              • Elite
                Senior Member
                • Apr 2004
                • 168

                #8
                Originally posted by Denver Dave
                Looks like Register Globals is now set to off as of today. Is there a php command to over-ride this if necessary rather than dealing with each and every variable name?
                Place a php.ini with the command "register_globals = On" in the directory where you require globals on??
                Last edited by Elite; 07-27-2007, 12:47 AM.

                Comment

                • AndrewT
                  Administrator
                  • Mar 2004
                  • 3655

                  #9
                  Elite is absolutely correct.

                  Rumor has it that PHP will even stop supporting register_globals at some point down the road. It also can pose a security risk if inputs are not properly validated or initialized. I strongly recommend not depending on register_globals being enabled.

                  Comment

                  Working...