By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,506 Members | 1,876 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,506 IT Pros & Developers. It's quick & easy.

Disadvantages of GET/POST/COOKIES

P: 3
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_Minor) = explode(".",$raw);

if (($v_Upper == 4 && $v_Major < 1) || $v_Upper < 4) {
$_FILES = $HTTP_POST_FILES;
$_ENV = $HTTP_ENV_VARS;
$_GET = $HTTP_GET_VARS;
$_POST = $HTTP_POST_VARS;
$_COOKIE = $HTTP_COOKIE_VARS;
$_SERVER = $HTTP_SERVER_VARS;
$_SESSION = $HTTP_SESSION_VARS;
$_FILES = $HTTP_POST_FILES;
}

if (!ini_get('register_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
Sep 8 '06 #1
Share this Question
Share on Google+
3 Replies


ronverdonk
Expert 2.5K+
P: 4,258
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_VARS contains the same initial information, but is not an autoglobal.
(Note that $HTTP_COOKIE_VARS and $_COOKIE are different variables and that PHP handles them as such)
$HTTP_SERVER_VARS is still available, but deprecated
$HTTP_SESSION_VARS array still available, but deprecated
Ronald :cool:
Sep 9 '06 #2

P: 3
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.
Sep 14 '06 #3

ronverdonk
Expert 2.5K+
P: 4,258
There are a number of reasons, such as the default setting of register_globals 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
http://nl2.php.net/manual/en/languag...s.superglobals

Ronald :cool:
Sep 15 '06 #4

Post your reply

Sign in to post your reply or Sign up for a free account.