¾Æ·¡¼Ò½º¸¦ 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Æú´õ¸¦ ¸¸µé¾î ÁÝ´Ï´Ù..(Æú´õ ±ÇÇѼ³Á¤ 707)
ÀÌÁ¦ ³²Àº°ÍÀº Å×½ºÆ®
ƯÁ¤°Ô½ÃÆÇ¿¡¸¸ Àû¿ëÇÏ·Á¸é.. 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("ÄÚµåÀÔ·ÂÀÌ ¿Ã¹Ù¸¥Áö È®ÀÎÇϼ¼¿ä."); }
ÇϽøé ÇØ´ç ¾ÆÀ̵𸸠Á¦¿ÜÇÏ°í Àû¿ëµË´Ï´Ù..^^;
// ȸ¿ø°¡ÀÔÇÒ ¶§ ·Îº¿±Û Á¦ÇÑÇϱâ
±Ý¹æ Àû¿ëÇØ ºÃ½À´Ï´Ù. ¿À·ù°¡ ÀÖÀ» ¼öµµ ÀÖ°ÚÁÒ. Àú´Â ¾ø³×¿ä. ÀÌ»ó ÀÖÀ¸¸é ¸»¾¸ÇØ ÁÖ¼¼¿ä.
/// 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("ÄÚµåÀÔ·ÂÀÌ ¿Ã¹Ù¸¥Áö È®ÀÎÇϼ¼¿ä.");
// »èÁ¦
mysql_close($connect); ¸¦ ã¾Æ¼ ±× À§¿¡
// ÄÚµåÆÄÀÏ ÀÚµ¿»èÁ¦. $anti_codedir = './anti_code/'; $dir = opendir($anti_codedir); while((false!==($file=readdir($dir)))) if($file!="." and $file !="..") @unlink($anti_codedir.'/'.$file); closedir($dir); ¸¦ ³ÖÀ¸¼¼¿ä.
|
¼£·Ò~
³! ÀÚÀ¯ÀÎ... |
|
|