Jump to content

Recommended Posts

hmm

 

It would be the "Register_Globals" php ini directive, if set to true, any $_REQUEST (and im sure $_SESSION) data gets automatically put into a global variable.

 

Register Globals is quite a common securit flaw for beginners as it seems easier to use it, but for best practice you should try not to rely on global variables (only some safe environment variables).

 

http://uk.php.net/register_globals For more information.

there is also this interesting comment on that page:

 

BEWARE of using register_globals = On, it's not only bad karma but highly dangerous.

 

Consider the following coding:

 

<?php
// assume $_SESSION['user'] = array('Hello', 'World');
// assume session_start() was called somewhere before.

    print('<pre>Contents of array $_SESSION[\'user\']');
    print_r($_SESSION['user']);
    print('<hr>Contents of array $user (PHP SETUP register_globals = On)');
    print_r($user);
    print('</pre>');
?>

 

If you manipulate $user you'll manipulate $_SESSION['user'] as well with PHP SETUP register_globals = On.

 

So please avoid it at any cost, no serious programmer would ever want to have register_globals = On.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.