마우스우클릭 방지 한방에 후킹 > 그누보드5 팁자료실

그누보드5 팁자료실

마우스우클릭 방지 한방에 후킹 정보

마우스우클릭 방지 한방에 후킹

본문

 

그누순정 55832 버전 이상입니다.
아래의 코드를 적은 후 그 php 파일을 이름은 아무거나 주고 extend 디렉토리로 업로드해 주세요.
관리자는 우클릭이 가능하고 나머지는 우클릭을 금지합니다.

 

<?php
if (!defined('_GNUBOARD_')) exit;
add_event('tail_sub', function() {
    global $is_admin;
    if (!$is_admin) echo "<script>document.oncontextmenu = document.onselectstart = document.ondragstart = () => { return false; }</script>";
});

 

----------

 

개인적으로 https://sir.kr/g5_tip/22905 웹폰트와 함께 붙여서 아래처럼 사용하고 있습니다.

 

<?php
if (!defined('_GNUBOARD_')) exit;
add_event('tail_sub', function() {
    echo "
        <style>
        @font-face { font-family:'NEXON Lv1 Gothic OTF'; src:url('https://cdn.jsdelivr.net/gh/projectnoonnu/noonfonts_20-04@2.1/NEXON Lv1 Gothic OTF.woff') format('woff'); }
        div, span, table, p, input, textarea, button, select, code, h1, h2, h3 { font-family:'NEXON Lv1 Gothic OTF' !important; }
        </style>
    ";
    global $is_admin;
    if (!$is_admin) echo "<script>document.oncontextmenu = document.onselectstart = document.ondragstart = () => { return false; }</script>";
});

 

----------

 

[ 추가사항 ]

생각해보니 글쓰는 사람이 write 모드에서 우클릭이 잠겨 있으면 좀 이상할 것 같네요.

그래서 글쓰기시에는 등급에 상관없이 우클릭을 개방한다는 조건까지 감안한다면 아래처럼요.

 

<?php
if (!defined('_GNUBOARD_')) exit;
add_event('tail_sub', function() {
    global $is_admin;
    $ok_mouse = $is_admin || basename($_SERVER['PHP_SELF']) === "write.php";
    if (!$ok_mouse) echo "<script>document.oncontextmenu = document.onselectstart = document.ondragstart = () => { return false; }</script>";
});

 

----------

 

<?php
if (!defined('_GNUBOARD_')) exit;
add_event('tail_sub', function() {
    echo "
        <style>
        @font-face { font-family:'NEXON Lv1 Gothic OTF'; src:url('https://cdn.jsdelivr.net/gh/projectnoonnu/noonfonts_20-04@2.1/NEXON Lv1 Gothic OTF.woff') format('woff'); }
        div, span, table, p, input, textarea, button, select, code, h1, h2, h3 { font-family:'NEXON Lv1 Gothic OTF' !important; }
        </style>
    ";
    global $is_admin;
    $ok_mouse = $is_admin || basename($_SERVER['PHP_SELF']) === "write.php";
    if (!$ok_mouse) echo "<script>document.oncontextmenu = document.onselectstart = document.ondragstart = () => { return false; }</script>";
});

 

----------

 

[ 스킨과의 연동 ]https://sir.kr/g5_skin/60391

추천
6

댓글 20개

전체 150 |RSS
그누보드5 팁자료실 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT