글 자동폭파

글 자동폭파

QA

글 자동폭파

본문

http://sir.co.kr/bbs/board.php?bo_table=g4_tiptech&wr_id=12417 

 

이쪽에서 자동폭파 기능을 적용하려고하고있씁니다.

 

근데 이쪽에서 코딩한거랑 제가 사용하는 게시판이랑 좀 달라서요~

 

링크 주소는 보통 리스트보이고 글 들어가는 형식인데

 

제가 쓰는게시판은 방명록 형태여서

 

list.skin.php 에 적용해도 삭제가 안되는건지

 

view.skin.php 는 적용이 잘됩니다..

저는 wr_5 여분 필드를 이용했는데

 

아래가 list.skin.php 입니다..

 

왜 얘는 삭제가 자동 폭파가 안될까요?

 

//자폭 시작

for ($i=0; $i<count($list); $i++) {

 $count_write = 0;

 $count_comment = 0;

 if($list[$i][wr_5]) { 

  $g4[time_ymd] = date("Y-m-d H:i", $g4[server_time]); 

  $stoday = $g4[time_ymd];

  $bombdate = $list[$i][wr_5];

  $By = substr($bombdate,0,4);

  $Bm = substr($bombdate,5,2);

  $Bd = substr($bombdate,8,2) + 7;

  $Bh = substr($bombdate,11,2);

  $Bi = substr($bombdate,14,2);

  $bombdate7 = date("Y-m-d H:i",mktime($Bh,$Bi,0,$Bm,$Bd,$By) );

  $bombc = $list[$i][wr_id];

  if ($stoday > $bombdate7) {

  $sql = " select wr_id, mb_id, wr_is_comment from $write_table where wr_parent = '$bombc' order by wr_id ";

  $result = sql_query($sql);

  while ($row = sql_fetch_array($result)) 

  {

   // 원글이라면

   if (!$row[wr_is_comment]) 

   {

    // 원글 포인트 삭제

    if (!delete_point($row[mb_id], $bo_table, $row[wr_id], '쓰기'))

     insert_point($row[mb_id], $board[bo_write_point] * (-1), "$board[bo_subject] $row[wr_id] 글삭제");

    // 업로드된 파일이 있다면 파일삭제

    $sql2 = " select * from $g4[board_file_table] where bo_table = '$bo_table' and wr_id = '$row[wr_id]' ";

    $result2 = sql_query($sql2);

    while ($row2 = sql_fetch_array($result2)){

     @unlink("$g4[path]/data/file/$bo_table/$row2[bf_file]");

     @unlink("$g4[path]/data/file/$bo_table/thumb/$write[wr_id]"); //썸네일 삭제 

     @unlink("$g4[path]/data/file/$bo_table/latest_thumb/$write[wr_id]"); //최근게시물 썸네일 삭제

    }

    //추천기록 삭제

    sql_query(" delete from g4_board_good where wr_id = '$row[wr_id]' AND bo_table = '$bo_table' "); //수정

     

    // 파일테이블 행 삭제

    sql_query(" delete from $g4[board_file_table] where bo_table = '$bo_table' and wr_id = '$row[wr_id]' ");

    $count_write++;

   } 

   else 

   {

    // 코멘트 포인트 삭제

    if (!delete_point($row[mb_id], $bo_table, $row[wr_id], '코멘트'))

     insert_point($row[mb_id], $board[bo_comment_point] * (-1), "$board[bo_subject] {$view[wr_id]}-{$row[wr_id]} 코멘트삭제");

    $count_comment++;

   }

  }

  // 게시글 삭제

  sql_query(" delete from $write_table where wr_parent = '$bombc' ");

  // 최근게시물 삭제

  sql_query(" delete from $g4[board_new_table] where bo_table = '$bo_table' and wr_parent = '$bombc' ");

  // 스크랩 삭제

  sql_query(" delete from $g4[scrap_table] where bo_table = '$bo_table' and wr_id = '$bombc' ");

  // 공지사항 삭제

  $notice_array = explode("\n", trim($board[bo_notice]));

  $bo_notice = "";

  for ($k=0; $k<count($notice_array); $k++)

   if ((int)$bombc != (int)$notice_array[$k])

    $bo_notice .= $notice_array[$k] . "\n";

  $bo_notice = trim($bo_notice);

  sql_query(" update $g4[board_table] set bo_notice = '$bo_notice' where bo_table = '$bo_table' ");

  // 글숫자 감소

  if ($count_write > 0 || $count_comment > 0)

   sql_query(" update $g4[board_table] set bo_count_write = bo_count_write - '$count_write', bo_count_comment = bo_count_comment - '$count_comment' where bo_table = '$bo_table' ");

  $bend = 1;

  }

 }

 if(count($list) == $i+1 && $bend == 1){

  goto_url("./board.php?bo_table=$bo_table&page=$page");}

}

//자폭 끝 

 

 

 

 

 

그리고 혹시 사용자가 들어가기 전까지는 삭제가 안되던데

 

시간되면 그냥 알림창없이 쥐도 새도 모르게 삭제되게할수없나요?

이 질문에 댓글 쓰기 :

답변 2

저도 초보 입니다. 전에 자동폭파 코드를 다룬적이 있습니다.

List page 에서는 남아 있어나 사용자가 들어 가서 클릭시에 삭제 됩니다.

컴퓨터는 주어진 명령만 하기때문에...자체 판단력은 없습니다. 

"그리고 혹시 사용자가 들어가기 전까지는 삭제가 안되던데 시간되면 그냥 알림창없이 쥐도 새도 모르게 삭제되게할수없나요?"

에 대한 답변 입니다

 

가능합니다.

 

방법이야 여러가지가 있습니다만...

 

일단 자동폭파를 처리할 PHP 파일을 하나 만드시고요..

방법1. Cron으로 스케쥴러를 돌려서 해당 PHP파일을 주기적으로 호출해서 처리하는 방법이 있고요... (서버 호스팅만 가능하시겠네요)

방법2. common이나 header등에 자동폭파 처리 PHP를 삽입하는 방법이 있겠네요.

 

답변을 작성하시기 전에 로그인 해주세요.
전체 14,991
QA 내용 검색
filter #php ×

회원로그인

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