채택완료

$check_keys = array( 이 구문은 어떤용도로 쓰이는거죠?

2023-02-01 (수) 20:25:37 1,403

그누보드 관리자쪽 업데이트쪽 보니까 아래 구문과 비슷한게 다 있더라구요

왜 있는거에요?

$check_keys = array(
    'po_subject',
    'po_poll1',
    'po_poll2',
    'po_poll3',
    'po_poll4',
    'po_poll5',
    'po_poll6',
    'po_poll7',
    'po_poll8',
    'po_poll9',
    'po_cnt1',
    'po_cnt2',
    'po_cnt3',
    'po_cnt4',
    'po_cnt5',
    'po_cnt6',
    'po_cnt7',
    'po_cnt8',
    'po_cnt9',
    'po_etc',
    'po_level',
    'po_point',
    'po_id'
);

foreach ($_POST as $key => $value) {
    if (empty($value)) {
        continue;
    }

    if (in_array($key, $check_keys)) {
        $_POST[$key] = strip_tags(clean_xss_attributes($value));
    }
}
 

|

답변 2개

채택된 답변
+20 포인트

https://github.com/gnuboard/gnuboard5/blob/master/lib/common.lib.php#L3277

https://www.php.net/manual/en/function.strip-tags

넘겨받은 요청변수들에 대해

Cross-site scripting 이 될수있는 문자열이나 html 태그가 존재할 경우의

일괄 필터링을 하기 위함입니다.

2023-02-02 (목) 06:13:57

https://www.php.net/manual/en/language.types.array.php

array ()함수는 배열을 만들어 줍니다.

답변을 작성하려면 로그인이 필요합니다.