얼렁뚱땅코드/그누보드

스팸글방지 : href 태그 방지

얼렁뚱땅 디자이너 2021. 12. 1. 16:20

1. 게시판 설정에서 html, dhtml 권한 9

 

2. bb/write_update.php 토큰체크 아래 하단 부분 입력 #38줄

 

 

// href 태그입력방지 태그 --------시작

 

$wr_content = '';

if (isset($_POST['wr_content'])) {

    $wr_content = substr(trim($_POST['wr_content']),0,65536);

    $wr_content = preg_replace("#[\\\]+$#", "", $wr_content);

    if (strpos($wr_content, 'href')) {

        alert('href 태그는 사용할 수 없습니다.');

        exit;

    }

}

if ($wr_content == '') {

    $msg[] = '<strong>내용</strong>을 입력하세요.';

}

 

 

// href 태그입력방지 태그 --------끝 (html모드 권한 9, dhtml 권한 9)

 

 

 

+ 코멘트에도 방지하기 #12줄

 

 

C:\xampp\htdocs\hantaclub\bbs/write_comment_update.php
#12

// 090710
if (substr_count($wr_content, "") > 50) {
   
alert('내용에 올바르지 않은 코드가 다수 포함되어 있습니다.');
   
exit;
}
if (strpos($wr_content, 'href')) {
   
alert('href 태그는 사용할 수 없습니다.');
   
exit;
}