// °øÁö -> ÀÏ¹Ý±Û if(!$notice&&$s_data[headnum]<="-2000000000") { $temp=mysql_fetch_array(mysql_query("select max(division) from $t_division"."_$id")); $max_division=$temp[0]; $temp=mysql_fetch_array(mysql_query("select max(division) from $t_division"."_$id where num>0 and division!='$max_division'")); if(!$temp[0]) $second_division=0; else $second_division=$temp[0];
// Çìµå³Ñ+1 ÇѰªÀ» °¡Áü;; $max_headnum=mysql_fetch_array(mysql_query("select min(headnum) from $t_board"."_$id where (division='$max_division' or division='$second_division') and headnum>-2000000000")); // °øÁö°¡ ¾Æ´Ñ ÃÖ¼Ò headnum ±¸ÇÔ $headnum=$max_headnum[0]-1;
$next_data=mysql_fetch_array(mysql_query("select no,headnum,division from $t_board"."_$id where (division='$max_division' or division='$second_division') and headnum='$max_headnum[0]' and arrangenum='0'")); // ´ÙÀ½±ÛÀ» ±¸ÇÔ;; if(!$next_data[0]) $next_data[0]="0"; $next_no=$next_data[0];
$prev_data=mysql_fetch_array(mysql_query("select no from $t_board"."_$id where (division='$max_division' or division='$second_division') and headnum<'$headnum' and no!='$no' order by headnum desc limit 1")); // ÀÌÀü±ÛÀ» ±¸ÇÔ;; if($prev_data[0]) $prev_no=$prev_data[0]; else $prev_no=0;
$child="0"; $depth="0"; $arrangenum="0"; $father="0"; minus_division($s_data[division]); @mysql_query("update $t_board"."_$id set headnum='$headnum',prev_no='$prev_no',next_no='$next_no',child='$child',depth='$depth',arrangenum='$arrangenum',father='$father',name='$name',email='$email',homepage='$homepage',reg_date='$reg_date',subject='$subject',memo='$memo',sitelink1='$sitelink1',sitelink2='$sitelink2',use_html='$use_html',reply_mail='$reply_mail',is_secret='$is_secret',category='$category' $del_que1 $del_que2 where no='$no'") or error(mysql_error()); plus_division($division);
// ´ÙÀ½±ÛÀÇ ÀÌÀü±ÛÀ» ¼öÁ¤ if($next_no)mysql_query("update $t_board"."_$id set prev_no='$no' where division='$next_data[division]' and headnum='$next_data[headnum]'");
// ÀÌÀü±ÛÀÇ ´ÙÀ½±ÛÀ» ¼öÁ¤ if($prev_no)mysql_query("update $t_board"."_$id set next_no='$no' where no='$prev_no'");
mysql_query("update $t_board"."_$id set prev_no=0 where (division='$max_division' or division='$second_division') and prev_no='$s_data[no]' and headnum!='$next_data[headnum]'"); mysql_query("update $t_category"."_$id set num=num-1 where no='$s_data[category]'",$connect); mysql_query("update $t_category"."_$id set num=num+1 where no='$category'",$connect); }
// ÀÏ¹Ý±Û -> °øÁö elseif($notice&&$s_data[headnum]>-2000000000) { $temp=mysql_fetch_array(mysql_query("select max(division) from $t_division"."_$id")); $max_division=$temp[0]; $temp=mysql_fetch_array(mysql_query("select max(division) from $t_division"."_$id where num>0 and division!='$max_division'")); if(!$temp[0]) $second_division=0; else $second_division=$temp[0];
$max_headnum=mysql_fetch_array(mysql_query("select min(headnum) from $t_board"."_$id where division='$max_division' or division='$second_division'")); // ÃÖ°í±ÛÀ» ±¸ÇÔ;; $headnum=$max_headnum[0]-1; if($headnum>-2000000000) $headnum=-2000000000; // ÃÖ°í headnumÀÌ °øÁö°¡ ¾Æ´Ï¸é ÇöÀç ±Û¿¡ °øÁö¸¦ ³ÖÀ½;
$next_data=mysql_fetch_array(mysql_query("select no,headnum,division from $t_board"."_$id where (division='$max_division' or division='$second_division') and headnum='$max_headnum[0]' and arrangenum='0'")); if(!$next_data[0]) $next_data[0]="0"; $next_no=$next_data[0]; $prev_no=0; $child="0"; $depth="0"; $arrangenum="0"; $father="0"; minus_division($s_data[division]); $division=add_division(); @mysql_query("update $t_board"."_$id set division='$division',headnum='$headnum',prev_no='$prev_no',next_no='$next_no',child='$child',depth='$depth',arrangenum='$arrangenum',father='$father',name='$name',email='$email',homepage='$homepage',reg_date='$reg_date',subject='$subject',memo='$memo',sitelink1='$sitelink1',sitelink2='$sitelink2',use_html='$use_html',reply_mail='$reply_mail',is_secret='$is_secret',category='$category' $del_que1 $del_que2 where no='$no'") or error(mysql_error());
if($s_data[father]) mysql_query("update $t_board"."_$id set child='$s_data[child]' where no='$s_data[father]'"); // ´ä±ÛÀ̾úÀ¸¸é ¿øº»±ÛÀÇ ´ä±ÛÀ» ÇöÀç±ÛÀÇ ´ä±Û·Î ´ëü if($s_data[child]) mysql_query("update $t_board"."_$id set depth=depth-1,father='$s_data[father]' where no='$s_data[child]'"); // ´ä±ÛÀÌ ÀÖÀ¸¸é ÇöÀç±ÛÀÇ À§Ä¡·Î;;
// ¿ø·¡ ´ÙÀ½±Û·Î À̱ÛÀ» °¡Áö°í ÀÖ¾ú´ø µ¥ÀÌŸÀÇ prev_noÀ» ¹Ù²Þ; $temp=mysql_fetch_array(mysql_query("select max(headnum) from $t_board"."_$id where headnum<='$s_data[headnum]'")); $temp=mysql_fetch_array(mysql_query("select no from $t_board"."_$id where headnum='$temp[0]' and depth='0'")); mysql_query("update $t_board"."_$id set prev_no='$temp[no]' where prev_no='$s_data[no]'");
mysql_query("update $t_board"."_$id set next_no='$s_data[next_no]' where next_no='$s_data[no]'");
mysql_query("update $t_board"."_$id set prev_no='$no' where prev_no='0' and no!='$no'") or error(mysql_error()); // ´ÙÀ½±ÛÀÇ ÀÌÀü±ÛÀ» ¼³Á¤ mysql_query("update $t_category"."_$id set num=num-1 where no='$s_data[category]'",$connect); mysql_query("update $t_category"."_$id set num=num+1 where no='$category'",$connect);
// ÀϹÝ->ÀϹÝ, °øÁö->°øÁö À϶§ } else { @mysql_query("update $t_board"."_$id set name='$name',subject='$subject',email='$email',homepage='$homepage',reg_date='$reg_date',memo='$memo',sitelink1='$sitelink1',sitelink2='$sitelink2',use_html='$use_html',reply_mail='$reply_mail',is_secret='$is_secret',category='$category' $del_que1 $del_que2 where no='$no'") or error(mysql_error()); mysql_query("update $t_category"."_$id set num=num-1 where no='$s_data[category]'",$connect); mysql_query("update $t_category"."_$id set num=num+1 where no='$category'",$connect); }