1. <?php 
  2.   function stripslashes_deep($value) 
  3.   { 
  4.     $value = is_array($value) ? 
  5.              array_map('stripslashes_deep', $value) : 
  6.              stripslashes($value); 
  7.   
  8.     return $value; 
  9.   } 

  10.   if((function_exists("get_magic_quotes_gpc") 
  11.       && get_magic_quotes_gpc())    
  12.       || (ini_get('magic_quotes_sybase') 
  13.       && (strtolower(ini_get('magic_quotes_sybase'))!="off")) ){ 
  14.     stripslashes_deep($_GET); 
  15.     stripslashes_deep($_POST); 
  16.     stripslashes_deep($_COOKIE); 
  17.   } 
  18. ?>

--------------------------------------------------------------------------------------------


bool get_magic_quotes_gpc ( void )


magic_quotes_gpc 옵션을 현재 구성 설정을 반환 

magic_quotes_gpc 옵션을 실행시에하는 것은 작동하지 않을 것을 염두에 두고 설정을 시도하는 것

대한 자세한 내용은 magic_quotes의 보안섹션 참조

PHP 5.4.0은 항상 FALSE 반환


보통 Query문을 만들기 전에 addslash()를 써서 

I'm boy 를 I\'m boy 와 같은 형태로 이스케이프 시키게 되는데.... 

php.ini 설정에 magic_quotes 설정이 on되어 있는 경우 

Get, Post, Cookie가 전달시에 자동으로 이스케이프를 하므로 

addslash()를 하면 중복 이스케이프하게 된다. 

그래서 magic_quotes 설정이 on되어 있는지 확인하는 것이 

바로 get_magic_quotes_gpc() 함수임


:
BLOG main image

공지사항

카테고리

분류 (356)
main (1)
php5 (218)
HTML (36)
javascript (93)
IT 이론과 퍼온정보 (8)
깨작일상 (0)
곧 추가할 내용 (0)
추후 알아볼것들... (0)

최근에 올라온 글

최근에 달린 댓글

최근에 받은 트랙백

달력

«   2024/03   »
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31
Total :
Today : Yesterday :