Skip to content

조회 수 17860 추천 수 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. 세션관련 설명입니다

    Date2009.05.13 ByADMINPLAY Views7623
    Read More
  2. [php모듈] php 소스 암호화 하기 - php_screw-1.5

    Date2013.03.26 ByADMINPLAY Views9528
    Read More
  3. [PHP] 정규 표현식 정리

    Date2009.06.29 ByADMINPLAY Views14894
    Read More
  4. Warning: Unknown: open(, O_RDWR) failed: No such file ...

    Date2010.01.29 ByADMINPLAY Views19754
    Read More
  5. Warning: main(): URL file-access is disabled in the se...

    Date2009.06.04 ByADMINPLAY Views8235
    Read More
  6. Warning: flock(): supplied argument is not a valid str...

    Date2009.09.09 ByADMINPLAY Views16752
    Read More
  7. Ubuntu 7.04 Server 에 Zend Optimizer 3.2.8 설치하기!

    Date2009.07.19 ByADMINPLAY Views11636
    Read More
  8. Ubuntu 에서 PHP Screw 컴파일시 에러날 때

    Date2013.09.07 ByADMINPLAY Views6972
    Read More
  9. SENDMAIL SPAMASSASSIN 관리 local.cf

    Date2009.07.18 ByADMINPLAY Views11401
    Read More
  10. register_globals 에 따른 서버 변수형 변환

    Date2010.01.09 ByADMINPLAY Views17860
    Read More
  11. register_globals = off 란?

    Date2010.01.09 ByADMINPLAY Views15535
    Read More
  12. php컴파일에러(flex) configure: error: cannot find out...

    Date2009.08.08 ByADMINPLAY Views16094
    Read More
  13. php에서 curl 설치하기

    Date2009.06.01 ByADMINPLAY Views16841
    Read More
  14. php세션정리

    Date2009.09.19 ByADMINPLAY Views17178
    Read More
  15. PHPMyAdmin 오류조치법 Your PHP MySQL library version ...

    Date2009.01.20 ByADMINPLAY Views10021
    Read More
  16. PHPMyAdmin 오류조치법 The mbstring PHP extension was ...

    Date2009.01.20 ByADMINPLAY Views10859
    Read More
  17. PHPMyAdmin - blowfish_secret 해결방법

    Date2009.09.08 ByADMINPLAY Views16479
    Read More
  18. PHP.INI에서의 세션 관련설명

    Date2009.10.19 ByADMINPLAY Views17501
    Read More
  19. php.ini 옵션 한글설명

    Date2009.07.18 ByADMINPLAY Views9626
    Read More
  20. php.ini 세션유지 시간 설정

    Date2009.06.04 ByADMINPLAY Views10965
    Read More
Board Pagination Prev 1 2 3 Next
/ 3

Copyright ADMINPLAY corp. All rights reserved.

abcXYZ, 세종대왕,1234

abcXYZ, 세종대왕,1234