Files
firstgarden-web-gnu/bbs/ajax.filter.php

29 lines
887 B
PHP

<?php
include_once('./_common.php');
$subject = isset($_POST['subject']) ? strip_tags($_POST['subject']) : '';
$content = isset($_POST['content']) ? strip_tags($_POST['content']) : '';
//$filter = explode(",", strtolower(trim($config['cf_filter'])));
// strtolower 에 의한 한글 변형으로 아래 코드로 대체 (곱슬최씨님이 알려 주셨습니다.)
$filter = explode(",", trim($config['cf_filter']));
for ($i=0; $i<count($filter); $i++) {
$str = $filter[$i];
// 제목 필터링 (찾으면 중지)
$subj = $cont = "";
$pos = stripos($subject, $str);
if ($pos !== false) {
$subj = $str;
break;
}
// 내용 필터링 (찾으면 중지)
$pos = stripos($content, $str);
if ($pos !== false) {
$cont = $str;
break;
}
}
die("{\"subject\":\"$subj\",\"content\":\"$cont\"}");