xml 파일로 한번에 등록 하는방법이 있을까요?

제가 이전에 사용하던
로보드 사이트에서 게시글들을 xml형식으로 백업해두고 사용했는데
이번에 그누보드5로 전환했는데 게시글들을 그누보드5에 대량을 등록 하고 싶은데
방법이 있을까요?
|

답변 5개 / 댓글 3개

XML → XLS 변환해서 등록 됩니다
따로 코딩이 필요합니다
xml 파일의 구조와 그누보드5의 게시판 컬럼들의 양식을 비교 후, 
xml 파일의 키값을 그누보드5 게시판 컬럼과 1:1 매칭시켜서 
insert 문을 일괄적으로 생성해주는 스크립트를 만들어야합니다. 

분명히 어려운 작업은 아닌데, 이런 작업이 익숙하지 않다면 
AI의 도움을 받고도 혼자서는 방법을 못 찾을수도 있습니다. 
경험을 쌓는것도 매우 중요한 일이니 ai의 도움을 받아서 혼자 해보시고, 
잘 되시면 굿! 

잘 안되시면
https://sir.kr/boards/request
위 링크에 글을 올려서 견적을 받아보시거나

https://sir.kr/profile/d923e27d-5adc-4fad-a0ab-77eac5e70ba2
위 링크 보시면 저의 연락처가 있는데, 거기로 연락주시면 같이 고민해드리겠습니다.
그누 보드 테이블 분석해서 웹 프로그램을 하나짜서 사용하면되지만 
그걸 못하게다시면 
https://sir.kr/boards/request
글을 올려서 견적을 받아보시거나
아니면 마지막으로 
https://sir.kr/boards/developers_pr/13
저의 연락처가 있씁니다
연락주시면 같이 무료루 같이 고민해드릴게요
Copy
$sql = " insert into $write_table
                set wr_num = '$wr_num',
                     wr_reply = '$wr_reply',
                     wr_comment = 0,
                     ca_name = '$ca_name',
                     wr_option = '$html,$secret,$mail',
                     wr_subject = '$wr_subject',
                     wr_content = '$wr_content',
                     wr_link1 = '$wr_link1',
                     wr_link2 = '$wr_link2',
                     wr_link1_hit = 0,
                     wr_link2_hit = 0,
                     wr_hit = 0,
                     wr_good = 0,
                     wr_nogood = 0,
                     mb_id = '$mb_id',
                     wr_password = '',
                     wr_name = '$wr_name',
                     wr_email = '$wr_email',
                     wr_homepage = '',
                     wr_datetime = '".G5_TIME_YMDHIS."',
                     wr_last = '".G5_TIME_YMDHIS."',
                     wr_ip = '{$_SERVER['REMOTE_ADDR']}',
                     wr_1 = '{$wr1}',
                     wr_2 = '{$wr2}',
                     wr_3 = '{$wr3}',
                     wr_4 = '{$wr4}',
                     wr_5 = '{$wr5}',
                     wr_6 = '{$wr6}',
                     wr_7 = '{$wr7}',
                     wr_8 = '{$wr8}',
                     wr_9 = '{$wr9}',
                     wr_10 = '{$wr10}' ";
    sql_query($sql);
    $wr_id = sql_insert_id();
    // 부모 아이디에 UPDATE
    sql_query(" update $write_table set wr_parent = '$wr_id' where wr_id = '$wr_id' ");
    // 새글 INSERT
    sql_query(" insert into {$g5['board_new_table']} ( bo_table, wr_id, wr_parent, bn_datetime, mb_id ) values ( '{$bo_table}', '{$wr_id}', '{$wr_id}', '".G5_TIME_YMDHIS."', '$mb_id' ) ");
    // 게시글 1 증가
    sql_query("update {$g5['board_table']} set bo_count_write = bo_count_write + 1 where bo_table = '{$bo_table}'");


    // 파일 부분은 검증이 완료되지 않아서 취소.
    // 파일개수 체크
    /*
    $file_count   = 0;
    $upload_count = count($files);
    for ($i=0; $i<$upload_count; $i++) {
        if($files[$i] && file_exists($files[$i]))
            $file_count++;
    }
    // 디렉토리가 없다면 생성합니다. (퍼미션도 변경하구요.)
    @mkdir(G5_DATA_PATH.'/file/'.$bo_table, G5_DIR_PERMISSION);
    @chmod(G5_DATA_PATH.'/file/'.$bo_table, G5_DIR_PERMISSION);
    $chars_array = array_merge(range(0,9), range('a','z'), range('A','Z'));
    // 가변 파일 업로드
    $file_upload_msg = '';
    $upload = array();
    for ($i=0; $i<count($files); $i++) {
        $upload[$i]['file']     = '';
        $upload[$i]['source']   = '';
        $upload[$i]['filesize'] = 0;
        $upload[$i]['image']    = array();
        $upload[$i]['image'][0] = '';
        $upload[$i]['image'][1] = '';
        $upload[$i]['image'][2] = '';
        $upload[$i]['del_check'] = false;
        $tmp_file  = $files[$i];
        $filesize  = filesize($files[$i]);
        $filename  = basename($files[$i]);
        $filename  = get_safe_filename($filename);
        if (file_exists($tmp_file)) {
            //=================================================================\
            // 090714
            // 이미지나 플래시 파일에 악성코드를 심어 업로드 하는 경우를 방지
            // 에러메세지는 출력하지 않는다.
            //-----------------------------------------------------------------
            $timg = @getimagesize($tmp_file);
            // image type
            if ( preg_match("/\.({$config['cf_image_extension']})$/i", $filename) ||
                preg_match("/\.({$config['cf_flash_extension']})$/i", $filename) ) {
                if ($timg['2'] < 1 || $timg['2'] > 16)
                    continue;
            }
            //=================================================================
            $upload[$i]['image'] = $timg;
            // 프로그램 원래 파일명
            $upload[$i]['source'] = $filename;
            $upload[$i]['filesize'] = $filesize;
            // 아래의 문자열이 들어간 파일은 -x 를 붙여서 웹경로를 알더라도 실행을 하지 못하도록 함
            $filename = preg_replace("/\.(php|phtm|htm|cgi|pl|exe|jsp|asp|inc)/i", "$0-x", $filename);
            shuffle($chars_array);
            $shuffle = implode('', $chars_array);
            // 첨부파일 첨부시 첨부파일명에 공백이 포함되어 있으면 일부 PC에서 보이지 않거나 다운로드 되지 않는 현상이 있습니다. (길상여의 님 090925)
            $upload[$i]['file'] = abs(ip2long($_SERVER['REMOTE_ADDR'])).'_'.substr($shuffle,0,8).'_'.replace_filename($filename);
            $dest_file = G5_DATA_PATH.'/file/'.$bo_table.'/'.$upload[$i]['file'];
            // 업로드가 안된다면 에러메세지 출력하고 죽어버립니다.
            $error_code = copy($tmp_file, $dest_file) or die("upload error");
            // 올라간 파일의 퍼미션을 변경합니다.
            chmod($dest_file, G5_FILE_PERMISSION);
        }
    }
    // 나중에 테이블에 저장하는 이유는 $wr_id 값을 저장해야 하기 때문입니다.
    for ($i=0; $i<count($upload); $i++)
    {
        if (!get_magic_quotes_gpc()) {
            $upload[$i]['source'] = addslashes($upload[$i]['source']);
        }
        $sql = " insert into {$g5['board_file_table']}
                set bo_table = '{$bo_table}',


                     wr_id = '{$wr_id}',


                     bf_no = '{$i}',


                     bf_source = '{$upload[$i]['source']}',


                     bf_file = '{$upload[$i]['file']}',


                     bf_content = '',


                     bf_download = 0,


                     bf_filesize = '{$upload[$i]['filesize']}',


                     bf_width = '{$upload[$i]['image']['0']}',


                     bf_height = '{$upload[$i]['image']['1']}',


                     bf_type = '{$upload[$i]['image']['2']}',


                     bf_datetime = '".G5_TIME_YMDHIS."' ";
        sql_query($sql);
    }
    // 업로드된 파일 내용에서 가장 큰 번호를 얻어 거꾸로 확인해 가면서
    // 파일 정보가 없다면 테이블의 내용을 삭제합니다.
    $row = sql_fetch(" select max(bf_no) as max_bf_no from {$g5['board_file_table']} where bo_table = '{$bo_table}' and wr_id = '{$wr_id}' ");
    for ($i=(int)$row['max_bf_no']; $i>=0; $i--)
    {
        $row2 = sql_fetch(" select bf_file from {$g5['board_file_table']} where bo_table = '{$bo_table}' and wr_id = '{$wr_id}' and bf_no = '{$i}' ");
        // 정보가 있다면 빠집니다.
        if ($row2['bf_file']) break;
        // 그렇지 않다면 정보를 삭제합니다.
        sql_query(" delete from {$g5['board_file_table']} where bo_table = '{$bo_table}' and wr_id = '{$wr_id}' and bf_no = '{$i}' ");
    }

답변에 대한 댓글 1개

이거 쓰시면됩니다..
아마 RSS 형식으로 등록하는거 말씀하시는것 같은데 충분히 가능합니다.
XML → XLS 변환해서 등록도 되구요

자료실에도 구버전으로 있는데
6년전 자료라서 지금 쓰기엔 힘들것 같네요..

아래는 간단하게 그누보드5 에 샘플 글을 등록하는 예제 입니다.
이 예제 참고하셔서 작업하시면 될것 같아요.

의뢰원하시면 의뢰게시판에 남기시거나 제 프로필의 무료상담 카톡링크로 연락주셔도 됩니다.
비용은 10 입니다.

Copy
$sql = " insert into $write_table set wr_num = '$wr_num', wr_reply = '$wr_reply', wr_comment = 0, ca_name = '$ca_name', wr_option = '$html,$secret,$mail', wr_subject = '$wr_subject', wr_content = '$wr_content', wr_link1 = '$wr_link1', wr_link2 = '$wr_link2', wr_link1_hit = 0, wr_link2_hit = 0, wr_hit = 0, wr_good = 0, wr_nogood = 0, mb_id = '$mb_id', wr_password = '', wr_name = '$wr_name', wr_email = '$wr_email', wr_homepage = '', wr_datetime = '".G5_TIME_YMDHIS."', wr_last = '".G5_TIME_YMDHIS."', wr_ip = '{$_SERVER['REMOTE_ADDR']}', wr_1 = '{$wr1}', wr_2 = '{$wr2}', wr_3 = '{$wr3}', wr_4 = '{$wr4}', wr_5 = '{$wr5}', wr_6 = '{$wr6}', wr_7 = '{$wr7}', wr_8 = '{$wr8}', wr_9 = '{$wr9}', wr_10 = '{$wr10}' "; sql_query($sql); $wr_id = sql_insert_id(); // 부모 아이디에 UPDATE sql_query(" update $write_table set wr_parent = '$wr_id' where wr_id = '$wr_id' "); // 새글 INSERT sql_query(" insert into {$g5['board_new_table']} ( bo_table, wr_id, wr_parent, bn_datetime, mb_id ) values ( '{$bo_table}', '{$wr_id}', '{$wr_id}', '".G5_TIME_YMDHIS."', '$mb_id' ) "); // 게시글 1 증가 sql_query("update {$g5['board_table']} set bo_count_write = bo_count_write + 1 where bo_table = '{$bo_table}'"); // 파일 부분은 검증이 완료되지 않아서 취소. // 파일개수 체크 /* $file_count = 0; $upload_count = count($files); for ($i=0; $i<$upload_count; $i++) { if($files[$i] && file_exists($files[$i])) $file_count++; } // 디렉토리가 없다면 생성합니다. (퍼미션도 변경하구요.) @mkdir(G5_DATA_PATH.'/file/'.$bo_table, G5_DIR_PERMISSION); @chmod(G5_DATA_PATH.'/file/'.$bo_table, G5_DIR_PERMISSION); $chars_array = array_merge(range(0,9), range('a','z'), range('A','Z')); // 가변 파일 업로드 $file_upload_msg = ''; $upload = array(); for ($i=0; $i<count($files); $i++) { $upload[$i]['file'] = ''; $upload[$i]['source'] = ''; $upload[$i]['filesize'] = 0; $upload[$i]['image'] = array(); $upload[$i]['image'][0] = ''; $upload[$i]['image'][1] = ''; $upload[$i]['image'][2] = ''; $upload[$i]['del_check'] = false; $tmp_file = $files[$i]; $filesize = filesize($files[$i]); $filename = basename($files[$i]); $filename = get_safe_filename($filename); if (file_exists($tmp_file)) { //=================================================================\ // 090714 // 이미지나 플래시 파일에 악성코드를 심어 업로드 하는 경우를 방지 // 에러메세지는 출력하지 않는다. //----------------------------------------------------------------- $timg = @getimagesize($tmp_file); // image type if ( preg_match("/\.({$config['cf_image_extension']})$/i", $filename) || preg_match("/\.({$config['cf_flash_extension']})$/i", $filename) ) { if ($timg['2'] < 1 || $timg['2'] > 16) continue; } //================================================================= $upload[$i]['image'] = $timg; // 프로그램 원래 파일명 $upload[$i]['source'] = $filename; $upload[$i]['filesize'] = $filesize; // 아래의 문자열이 들어간 파일은 -x 를 붙여서 웹경로를 알더라도 실행을 하지 못하도록 함 $filename = preg_replace("/\.(php|phtm|htm|cgi|pl|exe|jsp|asp|inc)/i", "$0-x", $filename); shuffle($chars_array); $shuffle = implode('', $chars_array); // 첨부파일 첨부시 첨부파일명에 공백이 포함되어 있으면 일부 PC에서 보이지 않거나 다운로드 되지 않는 현상이 있습니다. (길상여의 님 090925) $upload[$i]['file'] = abs(ip2long($_SERVER['REMOTE_ADDR'])).'_'.substr($shuffle,0,8).'_'.replace_filename($filename); $dest_file = G5_DATA_PATH.'/file/'.$bo_table.'/'.$upload[$i]['file']; // 업로드가 안된다면 에러메세지 출력하고 죽어버립니다. $error_code = copy($tmp_file, $dest_file) or die("upload error"); // 올라간 파일의 퍼미션을 변경합니다. chmod($dest_file, G5_FILE_PERMISSION); } } // 나중에 테이블에 저장하는 이유는 $wr_id 값을 저장해야 하기 때문입니다. for ($i=0; $i<count($upload); $i++) { if (!get_magic_quotes_gpc()) { $upload[$i]['source'] = addslashes($upload[$i]['source']); } $sql = " insert into {$g5['board_file_table']} set bo_table = '{$bo_table}', wr_id = '{$wr_id}', bf_no = '{$i}', bf_source = '{$upload[$i]['source']}', bf_file = '{$upload[$i]['file']}', bf_content = '', bf_download = 0, bf_filesize = '{$upload[$i]['filesize']}', bf_width = '{$upload[$i]['image']['0']}', bf_height = '{$upload[$i]['image']['1']}', bf_type = '{$upload[$i]['image']['2']}', bf_datetime = '".G5_TIME_YMDHIS."' "; sql_query($sql); } // 업로드된 파일 내용에서 가장 큰 번호를 얻어 거꾸로 확인해 가면서 // 파일 정보가 없다면 테이블의 내용을 삭제합니다. $row = sql_fetch(" select max(bf_no) as max_bf_no from {$g5['board_file_table']} where bo_table = '{$bo_table}' and wr_id = '{$wr_id}' "); for ($i=(int)$row['max_bf_no']; $i>=0; $i--) { $row2 = sql_fetch(" select bf_file from {$g5['board_file_table']} where bo_table = '{$bo_table}' and wr_id = '{$wr_id}' and bf_no = '{$i}' "); // 정보가 있다면 빠집니다. if ($row2['bf_file']) break; // 그렇지 않다면 정보를 삭제합니다. sql_query(" delete from {$g5['board_file_table']} where bo_table = '{$bo_table}' and wr_id = '{$wr_id}' and bf_no = '{$i}' "); } // 파일의 개수를 게시물에 업데이트 한다. $row = sql_fetch(" select count(*) as cnt from {$g5['board_file_table']} where bo_table = '{$bo_table}' and wr_id = '{$wr_id}' "); sql_query(" update {$write_table} set wr_file = '{$row['cnt']}' where wr_id = '{$wr_id}' ");

답변에 대한 댓글 2개

$sql = " insert into $write_table
set wr_num = '$wr_num',
wr_reply = '$wr_reply',
wr_comment = 0,
ca_name = '$ca_name',
wr_option = '$html,$secret,$mail',
wr_subject = '$wr_subject',
wr_content = '$wr_content',
wr_link1 = '$wr_link1',
wr_link2 = '$wr_link2',
wr_link1_hit = 0,
wr_link2_hit = 0,
wr_hit = 0,
wr_good = 0,
wr_nogood = 0,
mb_id = '$mb_id',
wr_password = '',
wr_name = '$wr_name',
wr_email = '$wr_email',
wr_homepage = '',
wr_datetime = '".G5_TIME_YMDHIS."',
wr_last = '".G5_TIME_YMDHIS."',
wr_ip = '{$_SERVER['REMOTE_ADDR']}',
코드가 자꾸 이상하게 일부만 올라가네요..

답변을 작성하려면 로그인이 필요합니다.