// ÀÛ¼ºÀÚ : ÃÖ»ó¹Î // ¼öÁ¤ÀÏ : 2002³â 3¿ù 3ÀÏ // ÆÄÀϸí : boardDel.html // °Ô½ÃÆÇ ±Û »èÁ¦ include ("../inc/header.html"); // Çì´õ include ("../common/dbConnect.php"); // Ä¿³Ø¼Ç Æ÷ÇÔ include("boardInfo.php"); // °Ô½ÃÆÇ Á¤º¸ Æ÷ÇÔ include("../common/pageSkip.php"); // ÆäÀÌÁö ½ºÅµ°ü·Ã Æ÷ÇÔ include("../common/common.php"); // °øÅëÇÔ¼ö Æ÷ÇÔ include("./inc/header.html"); // °Ô½ÃÆÇ°ªÀÌ ¾øÀ»°æ¿ì ±âº»°Ô½ÃÆÇÀ» °¡Á®¿Â´Ù. ±×°Íµµ ¾øÀ½..¿¡·¯Áö ¸ð if($boardID == "") $boardID = "freeboard"; if($no == "") alert("¼öÁ¤ÇÒ °Ô½Ã¹° ¹øÈ£°¡ ¾ø½À´Ï´Ù.", 2); // °Ô½ÃÆÇ Á¤º¸ ÃßÃâ $info = new boardInfo($boardID); // °Ô½ÃÆÇ °øÅëÇÔ¼ö Æ÷ÇÔ include("boardCommon.php"); // °Ô½ÃÆÇ Á¦ÇÑ boardPermission("W"); function delete() { global $mode, $memberID, $writer, $password, $subject, $email, $homepage, $content, $enableHtml, $readLock, $info, $boardID, $conn, $no, $oldFile, $file, $file_name, $file_size, $file_type, $fileType, $fileName, $fileSize, $sortNo, $memberLevel; if($mode != "delete") return; if($memberID != $info->getLimitWrite() && $memberLevel < 10) { if($password == "") { alert("ÆÐ½º¿öµå¸¦ ÀÔ·ÂÇϼ¼¿ä", 1); return; } $flag = false; // ȸ¿øÁ¦ ¿©ºÎ üũ switch($info->getLimitWrite()) { case "A": case "M": $password = md5($memberID); $query = "select count(no) from $boardID where mId='$memberID' and password='$password' and no=$no"; $count = mysql_result($conn->runQuery($query), 0, 0); if($count == 0) { alert("º»ÀÎÀÇ ±Û¸¸ »èÁ¦ÇÒ ¼ö ÀÖ½À´Ï´Ù.", 1); return; } break; case "N": $password =md5($password); $query = "select count(no) from $boardID where no=$no and password='$password'"; $count = mysql_result($conn->runQuery($query), 0, 0); if($count == 0) { alert("ÆÐ½º¿öµå°¡ ÀÏÄ¡ÇÏÁö ¾Ê½À´Ï´Ù.", 1); return; } } } // ´äº¯±îÁö »èÁ¦ÇÏÁö ¾ÊÀ» °æ¿ì¸¦ üũ switch($info->getLimitDel()) { case "N": $query = "select count(no) from $boardID where originNo=$no"; $result = $conn->runQuery($query); if (mysql_result($result, 0, 0) > 0) { alert("´äº¯ÀÌ ÀÖ´Â °æ¿ì ³»¿ë°ú »ç¿ëÀÚ µ¥ÀÌÅ͸¸ »èÁ¦µË´Ï´Ù.", 1); $flag = true; } } // °Ô½Ã¹° Á¤º¸ ÃßÃâ $query = "select sortNo, replyNo, attachName from $boardID where no=$no"; $result = $conn->runQuery($query); $rows = mysql_fetch_array($result); $sortNo = $rows[sortNo]; $replyNo = $rows[replyNo]; $attachName = $rows[attachName]; $conn->runQuery("lock tables $boardID"); switch($info->getLimitDel()) { case "A": // Áö¿ï¶§±îÁöÀÇ $query = "select sortNo, no, attachName from $boardID where (sortNo=$sortNo) or ((sortNo<$sortNo and replyNo>$replyNo) and (originNo=$no or rootNo=$no))"; $result = $conn->runQuery($query); $count = 0; while($rows = mysql_fetch_array($result)) { if($rows[attachName] != "") $fileName[] = $rows[attachName]; $delNo[] = $rows[no]; $count++; } // ÷ºÎÆÄÀÏ »èÁ¦ if(count($fileName) > 0 ) { while(list($pos, $value) = each($fileName)) { $tmpName = "./${boardID}_data/".$value; unlink($tmpName); } } // °Ô½Ã¹° »èÁ¦ $query = "delete from $boardID where (sortNo=$sortNo) or ((sortNo<$sortNo and replyNo>$replyNo) and (originNo=$no or rootNo=$no))"; $conn->runQuery($query); // ¼ø¹ø ¾÷µ¥ÀÌÆ® $query = "update $boardID set sortNo=sortNo-$count where sortNo>$sortNo"; $conn->runQuery($query); break; case "N": // ÆÄÀÏ÷ºÎ »èÁ¦¸¦ À§ÇÑ Äõ¸®¹®Àå ÈÄ »èÁ¦ if($attachName != "") { $attachName = "./${boardID}_data/$attachName"; unlink($attachName); } $subject = "----- »èÁ¦µÈ ±ÛÀÔ´Ï´Ù -----."; $content = "»èÁ¦µÈ ±ÛÀÔ´Ï´Ù."; if($flag == true) { $query = "update $boardID set password='', writer='', email='', homepage='', subject='$subject', content='$content', mId='', attachName='', attachType='', attachSize='' where no=$no"; $conn->runQuery($query); } else { $query = "delete from $boardID where no=$no"; $conn->runQuery($query); // ³Ñ¹ö ¾÷µ¥ÀÌÆ® $query = "update $boardID set sortNo=sortNo-1 where sortNo>$sortNo"; $conn->runQuery($query); } } $conn->runQuery("unlock tables"); alert("»èÁ¦Çß½À´Ï´Ù.", 1); echo ""; exit(); } function printTable() { global $width, $align, $boardID, $no, $info, $conn, $secret, $memberID, $memberLevel; // °Ô½Ã¹° Á¤º¸ ÃßÃâ $query = "select * from $boardID where no=$no"; $result = $conn->runQuery($query); $rows = mysql_fetch_array($result); $subject = $rows[subject]; $content = $rows[content]; $writer = $rows[writer]; $email = $rows[email]; $homepage = $rows[homepage]; $enableHtml = $rows[enableHtml]; $attachName = $rows[attachName]; $readLock = $rows[readLock]; $readLock2 = "Y"; $mID = $rows[mId]; if($secret != "") { // ÆÐ½º¿öµå ºñ±³ $secret =md5($secret); $query = "select count(no) from $boardID where no=$no and password='$secret'"; $count = mysql_result($conn->runQuery($query), 0, 0); if($count == 0) alert("ÆÐ½º¿öµå°¡ ÀÏÄ¡ÇÏÁö ¾Ê½À´Ï´Ù.", 1); else $readLock2 = "N"; } switch($info->getLimitRead()) { case "A": case "M": if($mID != $memberID && $readLock =="Y") { alert("Àá°ÜÁø ±ÛÀÔ´Ï´Ù. ÀÛ¼ºÀÚ¿Í °ü¸®ÀÚ¿Ü¿¡´Â º¼ ¼ö ¾ø½À´Ï´Ù.", 2); } break; case "N": if($info->getLimitWrite() != "N" && $readLock == "Y") { if($mID != $memberID && !adminCheck($memberID)) alert("Àá°ÜÁø ±ÛÀÔ´Ï´Ù. ÀÛ¼ºÀÚ¿Í °ü¸®ÀÚ¿Ü¿¡´Â º¼ ¼ö ¾ø½À´Ï´Ù.", 2); } else if ($readLock == "Y" && $readLock2 == "Y") { echo "