Disadvantages of GET/POST/COOKIES

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ziana
    New Member
    • Aug 2006
    • 3

    Disadvantages of GET/POST/COOKIES

    Hi all,
    What is the disadvantages of using GET/POST/COOKIES in php?
    What's the different when i use global below included in each files?, i can pass all the parameter without $_POST etc. and register_global = OFF.


    >>>global.php :

    <?php
    /**
    * @version $Id: globals.php,v 1.7 2005/01/24 17:48:18 troozers Exp $
    * @package Mambo
    * @copyright (C) 2000 - 2005 Miro International Pty Ltd
    * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
    * Mambo is Free Software
    */

    $raw = phpversion();
    list($v_Upper,$ v_Major,$v_Mino r) = explode(".",$ra w);

    if (($v_Upper == 4 && $v_Major < 1) || $v_Upper < 4) {
    $_FILES = $HTTP_POST_FILE S;
    $_ENV = $HTTP_ENV_VARS;
    $_GET = $HTTP_GET_VARS;
    $_POST = $HTTP_POST_VARS ;
    $_COOKIE = $HTTP_COOKIE_VA RS;
    $_SERVER = $HTTP_SERVER_VA RS;
    $_SESSION = $HTTP_SESSION_V ARS;
    $_FILES = $HTTP_POST_FILE S;
    }

    if (!ini_get('regi ster_globals')) {
    while(list($key ,$value)=each($ _FILES)) $GLOBALS[$key]=$value;
    while(list($key ,$value)=each($ _ENV)) $GLOBALS[$key]=$value;
    while(list($key ,$value)=each($ _GET)) $GLOBALS[$key]=$value;
    while(list($key ,$value)=each($ _POST)) $GLOBALS[$key]=$value;
    while(list($key ,$value)=each($ _COOKIE)) $GLOBALS[$key]=$value;
    while(list($key ,$value)=each($ _SERVER)) $GLOBALS[$key]=$value;
    while(list($key ,$value)=@each( $_SESSION)) $GLOBALS[$key]=$value;
    foreach($_FILES as $key => $value){
    $GLOBALS[$key]=$_FILES[$key]['tmp_name'];
    foreach($value as $ext => $value2){
    $key2 = $key . '_' . $ext;
    $GLOBALS[$key2] = $value2;
    }
    }
    }
    ?>


    thx
  • ronverdonk
    Recognized Expert Specialist
    • Jul 2006
    • 4259

    #2
    You nwill notice in due time, when some programs will not work any longer. Study the PHP.NET documentation and your will see the following:
    HTTP_POST_VARS is still available, but deprecated
    HTTP_ENV_VARS is still available, but deprecated
    $HTTP_GET_VARS is still available,but deprecated
    $HTTP_COOKIE_VA RS contains the same initial information, but is not an autoglobal.
    (Note that $HTTP_COOKIE_VA RS and $_COOKIE are different variables and that PHP handles them as such)
    $HTTP_SERVER_VA RS is still available, but deprecated
    $HTTP_SESSION_V ARS array still available, but deprecated
    Ronald :cool:

    Comment

    • ziana
      New Member
      • Aug 2006
      • 3

      #3
      Originally posted by ronverdonk
      You nwill notice in due time, when some programs will not work any longer. Study the PHP.NET documentation and your will see the following:


      Ronald :cool:
      Thx Ronald, can u explain more about why all those parameters style are deprecated.

      Comment

      • ronverdonk
        Recognized Expert Specialist
        • Jul 2006
        • 4259

        #4
        There are a number of reasons, such as the default setting of register_global s and the fact that super globals were introduced:
        From version 4.1.0 onward, PHP provides an additional set of predefined arrays containing variables from the web server (if applicable), the environment, and user input. These new arrays are rather special in that they are automatically global--i.e., automatically available in every scope. For this reason, they are often known as 'autoglobals' or 'superglobals'.
        If you really want to know, you'll have to look at the PHPO documentation, in this case especially at


        Ronald :cool:

        Comment

        Working...