Skip to content

조회 수 17858 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄

<?
- register_globals = Off [Security, Performance]
; Global variables are no longer registered for input data (POST, GET, cookies,
; environment and other server variables). Instead of using $foo, you must use
; you can use $_REQUEST["foo"] (includes any variable that arrives through the
; request, namely, POST, GET and cookie variables), or use one of the specific
; $_GET["foo"], $_POST["foo"], $_COOKIE["foo"] or $_FILES["foo"], depending
; on where the input originates. Also, you can look at the
; import_request_variables() function.
; Note that register_globals is going to be depracated (i.e., turned off by
; default) in the next version of PHP, because it often leads to security bugs.
; Read http://php.net/manual/en/security.registerglobals.php for further
; information.

; register_globals = Off [보안 수행]
; 입력 데이터(POST, GET cookies) 와 서버형 변수들은 더이상 전역변수로 등록되지 않는다.
; $foo 란 변수를 사용할때 $_REAUEST["foo"] 로 사용 해야 한다.
; $_GET["foo"], $_POST["foo"], $_COOKIE["foo"] or $_FILES["foo"] 와 같이 사용

 

#####################################################################################
// php.ini 파일 에서 register_globals = on 시 변수형

$PHP_SELF;
$HTTP_REFERER;
$PATH_INFO;
$REMOTE_ADDR;

 

####################################################################################
// php 4.0 까지
// php.ini 파일에서 register_globals = off 시 변수형

$HTTP_SERVER_VARS[PHP_SELF];  // 현재 파일의 경로를 포함한 파일명을 보여줌
$HTTP_SERVER_VARS[HTTP_REFERER]; // 이전페이지의 URL 을 나타냄
$HTTP_SERVER_VARS[REMOTE_ADDR];  // 내 컴퓨터의 IP 주소를 나타냄
$HTTP_SERVER_VARS[SCRIPT_FILENAME]; // 해당 파일의 절대경로를 포함한 파일명을 보여주는 것입니다. /home/somedomain/a.php

$HTTP_GET_VARS[];     // HTTP 프로토콜에서 GET 방식으로 전송한 변수값
$HTTP_POST_VARS[];     // HTTP 프로토콜에서 POST 방식으로 전송한 변수값
$HTTP_FILES_VARS[];     // HTTP 프로토콜에서 파일 이름으로 전송한 변수값 [name][size][type]

// a.html?code=board&name=park 와 같은 스트링 값 까지 알아낼때
$url = $HTTP_SERVER_VARS["HTTP_REFERER"]."?".$HTTP_SERVER_VARS["QUERY_STRING"]

// register_globals_on 일때 변수 재 정의
@extract($HTTP_GET_VARS);
@extract($HTTP_POST_VARS);
@extract($HTTP_SERVER_VARS);
@extract($HTTP_ENV_VARS);


#####################################################################################
// php 4.1 부터
// php.ini 파일에서 register_globals = off 시 변수형
$_SERVER[PHP_SELF];
$_SERVER[SCRIPT_FILENAME]

$_POST[];
$_GET[];

$_SESSION['$member_id'];
$_COOKIE['$member_id'];

// a.html?code=board&name=park 와 같은 스트링 값 까지 알아낼때
$url = $_SERVER_VARS["HTTP_REFERER"]."?".$_SERVER_VARS["QUERY_STRING"]

// register_globals_on 일때 변수 재 정의
@extract($_GET);
@extract($_POST);
@extract($_SERVER);
@extract($_ENV);


#####################################################################################
$_POST와 $HTTP_POST_VARS는 차이

바뀌었습니다. long 타입이 예전부터 쓰이던 것이고, 짧은 타입은 4.1.0 이후로 생긴 것입니다.
두 배열은 같은 키와 같은 값을 가지고 있으므로 내용상 똑같습니다. 하지만 서로 다른 변수입니다.

결정적으로 이 둘이 다른 것은 짧은 타입의 경우 "자동전역(수퍼전역; SuperGlobal)변수"이지만 긴 타입은 그렇지 않다는 것입니다.
즉, $_POST는 함수선언에서 global $_POST; 로 선언하지 않고 사용이 가능하지만 $_HTTP_POST_VARS 는 선언을 해야만 전역으로 인식합니다.

짧은 형식이 '사용이 권장'되는 변수입니다. 긴 형식은 php-5.0 에서 php.ini에 의해 사라질 수 있습니다.

http://kr2.php.net/manual/kr/reserved.variables.php
http://kr2.php.net/manual/kr/language.variables.predefined.php
?>


  1. php mysql에 insert시 싱글쿼츠(홑따옴표) 입력 처리 (mag...

    Date2013.09.07 ByADMINPLAY Views8907
    Read More
  2. Ubuntu 에서 PHP Screw 컴파일시 에러날 때

    Date2013.09.07 ByADMINPLAY Views6970
    Read More
  3. [php모듈] php 소스 암호화 하기 - php_screw-1.5

    Date2013.03.26 ByADMINPLAY Views9526
    Read More
  4. configure: error: utf8_mime2text() has new signature, ...

    Date2010.05.18 ByADMINPLAY Views21852
    Read More
  5. oracle10g + php5.2.11 error [OCIEnvNlsCreate() failed]

    Date2010.02.24 ByADMINPLAY Views71247
    Read More
  6. Warning: Unknown: open(, O_RDWR) failed: No such file ...

    Date2010.01.29 ByADMINPLAY Views19752
    Read More
  7. register_globals 에 따른 서버 변수형 변환

    Date2010.01.09 ByADMINPLAY Views17858
    Read More
  8. register_globals = off 란?

    Date2010.01.09 ByADMINPLAY Views15533
    Read More
  9. 4.1.0이상 php 버전에서 register_globals = Off 일때 기...

    Date2010.01.09 ByADMINPLAY Views15420
    Read More
  10. PHP FreeTDS 사용 (MS-SQL)

    Date2010.01.05 ByADMINPLAY Views16927
    Read More
  11. Fatal error: Call to undefined function domxml_open_mem()

    Date2009.12.31 ByADMINPLAY Views17333
    Read More
  12. pear 1.9 업그레이드 및 패치설치

    Date2009.12.31 ByADMINPLAY Views17305
    Read More
  13. PEC HTTP Setup

    Date2009.12.31 ByADMINPLAY Views15920
    Read More
  14. PHP.INI에서의 세션 관련설명

    Date2009.10.19 ByADMINPLAY Views17499
    Read More
  15. Maximum execution time of 30 seconds exceeded

    Date2009.09.28 ByADMINPLAY Views17369
    Read More
  16. php세션정리

    Date2009.09.19 ByADMINPLAY Views17176
    Read More
  17. Warning: flock(): supplied argument is not a valid str...

    Date2009.09.09 ByADMINPLAY Views16750
    Read More
  18. PHPMyAdmin - blowfish_secret 해결방법

    Date2009.09.08 ByADMINPLAY Views16477
    Read More
  19. php컴파일에러(flex) configure: error: cannot find out...

    Date2009.08.08 ByADMINPLAY Views16091
    Read More
  20. PHP - eAccelerator 설치

    Date2009.08.03 ByADMINPLAY Views14998
    Read More
Board Pagination Prev 1 2 3 Next
/ 3

Copyright ADMINPLAY corp. All rights reserved.

abcXYZ, 세종대왕,1234

abcXYZ, 세종대왕,1234