그룹5개, 그룹당 보드 5개 일괄 생성 정보
그룹5개, 그룹당 보드 5개 일괄 생성
첨부파일
본문
매번 그룹 만들고 게시판 만드는게 귀찮아서 그룹5개, 그룹당 게시판 5개를 일괄 생성 수 수정해서 사용중
사용법 : 첨부파일을 root에 업로드해서 실행 (주소창에 도메인/board_set.php)
그룹 갯수 수정
에서 $i<=5 를 원하는 그룹 갯수로 수정
그룹당 게시판 갯수 수정
에서 $j<=5 를 원하는 그룹 갯수로 수정
첨부파일 내용
사용법 : 첨부파일을 root에 업로드해서 실행 (주소창에 도메인/board_set.php)
그룹 갯수 수정
// make group
for($i=1; $i<=5; $i++){
에서 $i<=5 를 원하는 그룹 갯수로 수정
그룹당 게시판 갯수 수정
//make board
for($j=1; $j<=5; $j++){
에서 $j<=5 를 원하는 그룹 갯수로 수정
첨부파일 내용
<?php
include_once("./_common.php");
if ($is_admin != 'super') {
alert("관리자 로그인 후 사용");
die();
}
// make group
for($i=1; $i<=5; $i++){
$gr_id = sprintf("%02d",$i);
$sql_common = " gr_subject = '그룹_{$gr_id}',
gr_device = 'both',
gr_admin = '',
gr_1_subj = '',
gr_2_subj = '',
gr_3_subj = '',
gr_4_subj = '',
gr_5_subj = '',
gr_6_subj = '',
gr_7_subj = '',
gr_8_subj = '',
gr_9_subj = '',
gr_10_subj = '',
gr_1 = '',
gr_2 = '',
gr_3 = '',
gr_4 = '',
gr_5 = '',
gr_6 = '',
gr_7 = '',
gr_8 = '',
gr_9 = '',
gr_10 = '',
gr_use_access = '0',
gr_order = '{$i}'
";
$sql = " select count(*) as cnt from {$g5['group_table']} where gr_id = '{$_POST['gr_id']}' ";
$row = sql_fetch($sql);
if (!$row['cnt']) {
$sql = " insert into {$g5['group_table']}
set gr_id = '{$gr_id}',
{$sql_common}
";
sql_query($sql);
}
//make board
for($j=1; $j<=5; $j++){
$bo_table = $gr_id."_".sprintf("%02d",$j);
$board_path = G5_DATA_PATH.'/file/'.$bo_table;
// 게시판 디렉토리 생성
@mkdir($board_path, G5_DIR_PERMISSION);
@chmod($board_path, G5_DIR_PERMISSION);
// 디렉토리에 있는 파일의 목록을 보이지 않게 한다.
$file = $board_path . '/index.php';
$f = @fopen($file, 'w');
@fwrite($f, '');
@fclose($f);
@chmod($file, G5_FILE_PERMISSION);
$sql_common = " gr_id = '{$gr_id}',
bo_subject = '게시판_{$bo_table}',
bo_mobile_subject = '',
bo_device = 'both',
bo_admin = '',
bo_list_level = '1',
bo_read_level = '1',
bo_write_level = '1',
bo_reply_level = '1',
bo_comment_level = '1',
bo_html_level = '1',
bo_link_level = '1',
bo_count_modify = '1',
bo_count_delete = '1',
bo_upload_level = '1',
bo_download_level = '1',
bo_read_point = '0',
bo_write_point = '0',
bo_comment_point = '0',
bo_download_point = '0',
bo_use_category = '0',
bo_category_list = '',
bo_use_sideview = '0',
bo_use_file_content = '0',
bo_use_secret = '0',
bo_use_dhtml_editor = '0',
bo_use_rss_view = '0',
bo_use_good = '0',
bo_use_nogood = '0',
bo_use_name = '0',
bo_use_signature = '0',
bo_use_ip_view = '0',
bo_use_list_view = '0',
bo_use_list_file = '0',
bo_use_list_content = '0',
bo_use_email = '0',
bo_use_cert = '0',
bo_use_sns = '0',
bo_table_width = '100',
bo_subject_len = '60',
bo_mobile_subject_len = '30',
bo_page_rows = '15',
bo_mobile_page_rows = '15',
bo_new = '24',
bo_hot = '100',
bo_image_width = '600',
bo_skin = 'basic',
bo_mobile_skin = 'basic',
bo_include_head = '_head.php',
bo_include_tail = '_tail.php',
bo_content_head = '',
bo_content_tail = '',
bo_mobile_content_head = '',
bo_mobile_content_tail = '',
bo_insert_content = '',
bo_gallery_cols = '4',
bo_gallery_width = '174',
bo_gallery_height = '124',
bo_mobile_gallery_width = '125',
bo_mobile_gallery_height= '100',
bo_upload_count = '2',
bo_upload_size = '1048579',
bo_reply_order = '1',
bo_use_search = '1',
bo_order = '{$j}',
bo_write_min = '0',
bo_write_max = '0',
bo_comment_min = '0',
bo_comment_max = '0',
bo_sort_field = '',
bo_1_subj = '',
bo_2_subj = '',
bo_3_subj = '',
bo_4_subj = '',
bo_5_subj = '',
bo_6_subj = '',
bo_7_subj = '',
bo_8_subj = '',
bo_9_subj = '',
bo_10_subj = '',
bo_1 = '',
bo_2 = '',
bo_3 = '',
bo_4 = '',
bo_5 = '',
bo_6 = '',
bo_7 = '',
bo_8 = '',
bo_9 = '',
bo_10 = ''
";
$row = sql_fetch(" select count(*) as cnt from {$g5['board_table']} where bo_table = '{$bo_table}' ");
if (!$row['cnt']){
$sql = " insert into {$g5['board_table']}
set bo_table = '{$bo_table}',
bo_count_write = '0',
bo_count_comment = '0',
$sql_common ";
sql_query($sql);
// 게시판 테이블 생성
$file = file(G5_PATH.'/adm/sql_write.sql');
$sql = implode($file, "\n");
$create_table = $g5['write_prefix'] . $bo_table;
// sql_board.sql 파일의 테이블명을 변환
$source = array('/__TABLE_NAME__/', '/;/');
$target = array($create_table, '');
$sql = preg_replace($source, $target, $sql);
sql_query($sql, FALSE);
}
}
}
goto_url(G5_ADMIN_URL."/board_list.php");
?>
추천
3
3
댓글 0개