웹마스터 팁
영문 스팸 방지
2013.09.16 15:04
하도 스팸이 많이 들어오고 있어서 꼼수를 좀 썼습니다.
일단 영문으로만 스팸이 들어오고 있어서 영문으로만 된 컨텐츠인지 확인하고 밀어내기 신공을 했습니다.
modules/board/board.controller.php 파일의 procBoardInsertDocument 함수를 수정했습니다.
일단 잠잠해져서 다행입니다만...
이글을 본 스패머가 또 뚫을려나요.. ^^;;
아래 빨간색 부분을 추가해 보세요. 저도 구글로 퍼서 한거여서 자세한 검증은 하지 않았습니다.
고수분들이 업그레이드를 해주시면 더욱 좋겠네요.
단점 : 영문 사이트를 운영중이신 분은 적용하시면 안되겠네요.
function procBoardInsertDocument() {
// check grant
if($this->module_info->module != "board") return new Object(-1, "msg_invalid_request");
if(!$this->grant->write_document) return new Object(-1, 'msg_not_permitted');
$logged_info = Context::get('logged_info');
// setup variables
$obj = Context::getRequestVars();
$obj->module_srl = $this->module_srl;
if($obj->is_notice!='Y'||!$this->grant->manager) $obj->is_notice = 'N';
$obj->commentStatus = $obj->comment_status;
settype($obj->title, "string");
//제목이 온리 영문인지 확인
if(!preg_match("/[\xA1-\xFE][\xA1-\xFE]/", $obj->title)){
//$output = "error";
return ;
}
if($obj->title == '') $obj->title = cut_str(strip_tags($obj->content),20,'...');
//setup dpcument title tp 'Untitled'
if($obj->title == '') $obj->title = 'Untitled';
// unset document style if the user is not the document manager
if(!$this->grant->manager) {
unset($obj->title_color);
unset($obj->title_bold);
}
...........
그럼 총총..
http://www.jquerykroea.pe.kr