www.webdeveloper.com
Results 1 to 5 of 5

Thread: Enabling global_register

  1. #1
    Join Date
    Jan 2008
    Posts
    45

    Enabling global_register

    Hi everyone,
    Can someone tell me how to use PHP ini to enable global_register=on in my server.

    Soneone help.

  2. #2
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    22,279
    Well, firstly, the setting is named "register_globals".

    Secondly, it has been deprecated for a reason, so in general, my suggestion would be to change your scripts to not depend upon it, and then leave it off. You can more-or-less emulate it on a per script basis by adding the following to the beginning of a given script (with the possibility of the same problems that using register_globals can cause):
    PHP Code:
    <?php
    import_request_variables
    ('gpc');
    Only specify the sources you need to be imported: g = GET, p = POST, and c = COOKIE; in order to avoid creating unnecessary avenues of attack. Of course, it's still better to not use this at all and directly reference the $_GET, $_POST, and/or $_COOKIE super-global arrays instead and simply get completely out of the habit of depending on such behavior.
    "Well done....Consciousness to sarcasm in five seconds!" ~ Terry Pratchett, Night Watch

    How to Ask Questions the Smart Way (not affiliated with this site, but well worth reading)

    My Blog
    cwrBlog: simple, no-database PHP blogging framework

  3. #3
    Join Date
    Jan 2008
    Posts
    45
    Hi NogDog,
    Thank you for your help. Fact is the scripts i ma trying to use is purchased from a vendor and vendor says register_globals = on is a requirment. I understand that this has some risk factors.

    Now having seen your suggestion i have checked my scripts but can't figure out where to change the script to not depend upon register_globals.

    If you permit me i will send one of the scripts i think should need changed to your eamil box. The content is too large to append here. But you may see the attached zip file here.
    Last edited by akluch2; 04-07-2010 at 11:22 AM.

  4. #4
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    22,279
    You can add the import_request_variables() call to the top of any of the scripts. It just needs to appear once in a given script before any other PHP code that might need to access the input variables.
    "Well done....Consciousness to sarcasm in five seconds!" ~ Terry Pratchett, Night Watch

    How to Ask Questions the Smart Way (not affiliated with this site, but well worth reading)

    My Blog
    cwrBlog: simple, no-database PHP blogging framework

  5. #5
    Join Date
    Jan 2008
    Posts
    45
    Thanks NoDog. My script is now working properly.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center

"

"