RadarURL

조회 수 5456 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄 첨부
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄 첨부

로봇에 의한 광고글을 못올리게하는 방법입니다..
요즘 워낙에,,봇들이 설치고 다녀서리,, 함 올려봅니다..-_--
원리는 글쓰기에서 랜덤숫자로된 코드 이미지를 보여주고 값을 입력하게한후..
키값이 맞으면 등록, 틀리면,, 등록을 못하게하는... 직접 설치해보시면 아실겁니다..^^;

이미지 코드 샘플은 위 이미지와 같습니다.

그럼.. 소스 나갑니다..

아래소스를 code_img.php로 저장후 제로보드(bbs)폴더안에 넣습니다..
<?
// 향상된 난수발생,생성.
mt_srand(hexdec(substr(md5(microtime()), -8)) & 0x7fffffff);
$rand_code .= mt_rand(1000,9999);

//anti_code폴더에 권한과 쓰기
$fp = fopen("anti_code/".$_GET['anti_robotCode'].".hnx","w") or die("쓰기에 실패");  
fwrite($fp, md5($rand_code), 1024);
chmod("anti_code/".$_GET['anti_robotCode'].".hnx", 0666) or die("권한 실패");
fclose($fp);
header ("Content-type: image/png");

//그림의 가로크기
$width = "80";
//그림의 세로크기
$height = "22";
$im = @imagecreate ($width, $height) or die ("이미지 에러!!");
  
//그림안의 색(rgb)
ImageColorAllocate($im, 255,255,255);
  
//그림의 테두리색(rgb색 코드)
$black = ImageColorAllocate($im, 219,219,219);
ImageRectangle($im,0,0,$width-1,$height-1,$black);
  
for ($i=0;$i<=128;$i++)
{
$point_color = imagecolorallocate ($im, mt_rand(0,255), mt_rand(0,255), mt_rand(0,255));
imagesetpixel($im,mt_rand(2,128),mt_rand(2,38),$point_color);
}
for ($i=0;$i<=5;$i++)
{
$text_color = imagecolorallocate ($im, mt_rand(0,255), mt_rand(0,128), mt_rand(0,255));
$x = 5 + $i * 20;
$y = mt_rand(1,5);
imagechar ($im, 5, $x, $y,  $rand_code{$i}, $text_color);
}
imagepng ($im);
imagedestroy ($im);
die();
?>

그다음..

제로보드(bbs)폴더/script/script_write.php 파일을 php전용 에디터로 열어..
if(!document.write.name.value)
  {
   alert('이름을 입력하여 주세요.');
   document.write.name.focus();
   return false;
  }
요부분 아래에 다음 소스를 넣어줍니다.

if(!document.write.anti_robotCodeimg.value)
  {
   alert('코드를 입력해주세요.');
   document.write.anti_robotCodeimg.focus();
   return false;
  }

그다음..

제로보드(bbs)폴더안 write_ok.php를 php전용 에디터로 열어..
24번째줄...
// 각종 변수 검사;;
if(!$member[no]) { 요거 다음줄에 아래소스를 넣습니다.

$codeFile = file("anti_code/".$_GET['anti_robotCode'].".hnx");        
if($codeFile[0] != md5($_POST['anti_robotCodeimg'])) Error("코드입력이 올바른지 확인하세요.");

그다음.. 소스 끝부분쯤에..
// MySQL 닫기 이거 바로위에 아래소스를 추가합니다.
// 파일 자동삭제.
$anti_codedir = './anti_code/';
$dir = opendir($anti_codedir);
while((false!==($file=readdir($dir))))
if($file!="." and $file !="..") @unlink($anti_codedir.'/'.$file);
closedir($dir);

그다음..

사용중인 스킨폴더안 write.php를 php전용 에디터로 열어..
소스 맨위에..
<?
// 향상된 난수발생,생성.
mt_srand(hexdec(substr(md5(microtime()), -8)) & 0x7fffffff);
$rand_codei = md5(mt_rand(1000000, 9999999));
?>
추가합니다..
그다음..
action=write_ok.php 이부분을..
action=write_ok.php<? echo "?anti_robotCode=".$rand_codei; ?> 이렇게 변경.

그다음..
이미지 코드가 보일 자리에..

<?if(!$member[no]){?>코드입력: <input name="anti_robotCodeimg" type="text" style="width:90px;height:21px;" class="input"> <img src="code_img.php<? echo '?anti_robotCode='.$rand_codei;?>" border="0" style="vertical-align:top;"><?}?>

넣어주세요...

이제 마지막으로..
제로보드폴더(bbs)안에 anti_code폴더를 만들어 줍니다..

이제 남은것은 테스트....^^;=3=3=3
############################################################
응용하면 회원가입페이지, 코멘트등에서도 사용할 수 있겠죠..^_^
이 방법 말고 세션을 이용한 방법도있는데..그 방법은 귀차니즘으로 안올림.;;...=3=3=3


--- 덧글 ---

꺾쇠
  // 회원가입할 때 로봇글 제한하기


금방 적용해 봤습니다. 오류가 있을 수도 있겠죠. 저는 없네요.
이상 있으면 말씀해 주세요.


/// member_join.php


맨 위에


<?
// 향상된 난수발생,생성.
mt_srand(hexdec(substr(md5(microtime()), -8)) & 0x7fffffff);
$rand_codei = md5(mt_rand(1000000, 9999999));
?>


action=member_join_ok.php 를 찾아서


action=member_join_ok.php<? echo "?anti_robotCode=".$rand_codei; ?>
로 변경


적당한 위치(저는 회원가입 아이콘 위에)


<input type=image border=0 src=images/button_join.gif>  
위에 아래처럼


<font color=red><b>코드입력</b></font>: <input name="anti_robotCodeimg" type="text" style="width:90px;height:21px;" class="input"> <img src="code_img.php<? echo '?anti_robotCode='.$rand_codei;?>" border="0" style="vertical-align:top;">
<input type=image border=0 src=images/button_join.gif>  



/// member_join_ok.php



if($member[no]&&!$mode) Error("이미 가입이 되어 있습니다.","window.close");
아래에


$codeFile = file("anti_code/".$_GET['anti_robotCode'].".hnx");
if($codeFile[0] != md5($_POST['anti_robotCodeimg'])) Error("코드입력이 올바른지 확인하세요.");


를 넣으면 됩니다.


토토루님 덕분에 좋은 팁을 적용하게 되었네요.



 토토루
  특정게시판에만 적용하려면..
write_ok.php에서..


if($id == "게시판아이디"){
$codeFile = file("anti_code/".$_GET['anti_robotCode'].".hnx");
if($codeFile[0] != md5($_POST['anti_robotCodeimg'])) Error("코드입력이 올바른지 확인하세요.");
}


이런식으로 하시면 됩니다..


또한..


반대로.. 특정 게시판만 제외하고 적용되게하려면..


if($id != "게시판아이디"){
$codeFile = file("anti_code/".$_GET['anti_robotCode'].".hnx");
if($codeFile[0] != md5($_POST['anti_robotCodeimg'])) Error("코드입력이 올바른지 확인하세요.");
}


하시면 해당 아이디만 제외하고 적용됩니다..^^;


p.s 꺽쇠 // 제 수고를 덜어주시네요,, 감사합니다..^^
드림팀 // 팥빙수 사주세요^^;


출처 : http://www.nzeo.com/bbs/zboard.php?id=cgi_tip&page=1&sn1=&divpage=1&sn=off&ss=on&sc=off&keyword=로봇&select_arrange=headnum&desc=asc&no=7272

?

공부 게시판

공부에 도움되는 글을 올려주세요.

  1. [공지] 공부 게시판 입니다.

    Date2003.08.18 By처누 Views928097
    read more
  2. http를 https로 리다이렉트하는 여러가지 방법

    Date2025.09.10 Category웹서버,WAS ByJaeSoo Views0
    Read More
  3. SSL인증서 없이 HTTPS에서 HTTP로 되돌리기

    Date2025.09.10 Category웹서버,WAS ByJaeSoo Views2
    Read More
  4. [SSL] win-acme, Let's encrypt로 무료 SSL 인증서 발급

    Date2025.09.10 Category웹서버,WAS ByJaeSoo Views0
    Read More
  5. [SSL] Windows 10에서 Let's Encrypt로 SSL 인증서 무료 발급받기

    Date2025.09.10 Category웹서버,WAS ByJaeSoo Views0
    Read More
  6. 무료로 https SSL/TLS 인증서를 발급받을 수 있는 인증 기관

    Date2025.09.10 Category웹서버,WAS ByJaeSoo Views0
    Read More
  7. 아파치 서버에 https SSL 인증서 적용하는 방법 (apache httpd)

    Date2025.09.10 Category웹서버,WAS ByJaeSoo Views0
    Read More
  8. 아파치2(Apache2) SSL HTTPS 적용하기

    Date2025.09.10 Category웹서버,WAS ByJaeSoo Views0
    Read More
  9. 아파치 웹서버에 멀티 도메인에 대한 80, 443 포트 설정하는 방법

    Date2025.09.10 Category웹서버,WAS ByJaeSoo Views0
    Read More
  10. Google Photo 대신 Immich를 써보자

    Date2025.08.07 Category소프트웨어 ByJaeSoo Views126
    Read More
  11. 남자 혹은 여자 진국 팁

    Date2025.07.24 Category연애 ByJaeSoo Views116
    Read More
  12. MBTI검사 16가지 유형 “간단 명료”하게 정리!

    Date2025.07.01 Category기타 ByJaeSoo Views132
    Read More
  13. [사진관리] PhotoPrism vs LibrePhoto 비교 소감

    Date2025.05.19 Category소프트웨어 ByJaeSoo Views14
    Read More
  14. MDF실, TPS실, EPS실 이게 뭘까?

    Date2025.04.15 Category네트워크 ByJaeSoo Views33
    Read More
  15. 알아두면 좋은 직장인 용어 정리

    Date2025.04.15 Category업무 ByJaeSoo Views37
    Read More
  16. 감기·독감·코로나19의 차이점, 신촌연세병원과 함께 알아봅시다.

    Date2025.01.08 Category건강 ByJaeSoo Views29
    Read More
  17. 집주인이 전세 보증금을 돌려주지 않을 때

    Date2024.11.29 Category생활 ByJaeSoo Views26
    Read More
  18. 자전거 타이어 종류 및 추천 2편 (승차감 타이어, 국토종주!)

    Date2024.10.15 Category자동차 ByJaeSoo Views53
    Read More
  19. 오도바이 센타 사장들은 어떤 브랜드를 싫어하고 좋아할까? [출처] 오도바이 센타 사장들은 어떤 브랜드를 싫어하고 좋아할까?|작성자 바이크신

    Date2024.10.15 Category자동차 ByJaeSoo Views78
    Read More
  20. 윈도우 자동 로그온 설정이 보이지 않을 때 조치사항

    Date2024.08.16 Category윈도우즈 ByJaeSoo Views203
    Read More
  21. 갤럭시S22 시리즈에서 SKT LTE 무제한 핫스팟 쓰는 방법! (SKT LTE 요금제만 해당!)

    Date2024.08.12 Category모바일 ByJaeSoo Views234
    Read More
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 ... 124 Next
/ 124


즐겨찾기 (가족)

JAESOO's HOMEPAGE


YOUNGAE's HOMEPAGE


장여은 홈페이지


장여희 홈페이지


장여원 홈페이지


즐겨찾기 (업무)

알리카페 홀릭

숭실대 컴퓨터 통신연구실 (서창진)

말레이시아 KL Sentral 한국인 GuestHouse


즐겨찾기 (취미)

어드민아이디

유에코 사랑회

아스가르드 좋은사람/나쁜사람

JServer.kr

제이서버 메타블로그

재수 티스토리


즐겨찾기 (강의, 커뮤니티)

재수 강의 홈페이지


한소리


VTMODE.COM


숭실대 인공지능학과


숭실대 통신연구실


베너