그누보드 [G5] 외부 프로그램 회원자료를 g5_member 로 이전하기
페이지 정보
본문
그누보드5 / z_import_run.php 로 파일 저장
독립적으로 제작된 회원 테이블의 자료를 그누보드5 의 자료로 복제하는 로직입니다.
동일한 아이디를 제외하고 그외 것들만 복제합니다.
<?php
include_once('./_common.php');
ob_end_clean();
include_once(G5_LIB_PATH.'/connect.lib.php');
include_once(G5_LIB_PATH.'/outlogin.lib.php');
set_time_limit ( 0 );
ini_set('memory_limit', '50M');
echo '<link rel="stylesheet" href="'.G5_CSS_URL.'/default.css">';
if($is_admin != 'super')
alert('최고관리자로 로그인 후 실행해 주십시오.', G5_URL);
$is_euckr = false;
?>
<style>
#g4_import_run {}
#g4_import_run ol {margin: 0;padding: 0 0 0 25px;border: 1px solid #E9E9E9;border-bottom: 0;background: #f5f8f9;list-style:none;zoom:1}
#g4_import_run li {padding:7px 10px;border-bottom:1px solid #e9e9e9}
#g4_import_run #run_msg {padding:30px 0;text-align:center}
</style>
<div id="hd">
<div id="hd_wrapper">
<div id="logo">
<a href="<?php echo G5_URL ?>"><img src="<?php echo G5_IMG_URL ?>/logo.jpg" alt="<?php echo $config['cf_title']; ?>"></a>
</div>
<ul id="tnb">
<?php if ($is_member) { ?>
<?php if ($is_admin) { ?>
<li><a href="<?php echo G5_ADMIN_URL ?>"><b>관리자</b></a></li>
<?php } ?>
<li><a href="<?php echo G5_BBS_URL ?>/member_confirm.php?url=<?php echo G5_BBS_URL ?>/register_form.php">정보수정</a></li>
<li><a href="<?php echo G5_BBS_URL ?>/logout.php">로그아웃</a></li>
<?php } else { ?>
<li><a href="<?php echo G5_BBS_URL ?>/register.php">회원가입</a></li>
<li><a href="<?php echo G5_BBS_URL ?>/login.php"><b>로그인</b></a></li>
<?php } ?>
</ul>
</div>
</div>
<hr>
<div id="wrapper">
<div id="g4_import_run">
<ol>
<?php
// 우편번호 mb_zip1 의 속성을 3byte 에서 7byte 로 변경
sql_query(" ALTER TABLE {$g5['member_table']} modify mb_zip1 varchar(7) NOT NULL DEFAULT '' ", true);
// 원본 테이블을 가져옵니다.
$sql = " select * from member order by idx asc";
$result = sql_query($sql);
for($i=0; $row=sql_fetch_array($result); $i++) {
// 중복체크
$sql2 = " select count(*) as cnt from {$g5['member_table']} where mb_id = '{$row['id']}' ";
$row2 = sql_fetch($sql2);
if($row2['cnt'])
continue;
// 닉네임 중복체크
$sql2 = " select count(*) as cnt from {$g5['member_table']} where mb_nick = '{$row['name']}' ";
$row2 = sql_fetch($sql2);
if($row2['cnt'])
$mb_nick = $row['name'].strtotime(date($row['wdate'])); // 닉네임 중복되면 뒤에 timestamp 를 추가시킴
$sql_common = " mb_id = '{$row['id']}' ";
$sql_common .= ", mb_password = '".sql_password($row['pwd'])."' ";
$sql_common .= ", mb_name = '{$row['name']}' ";
$sql_common .= ", mb_nick = '{$mb_nick}' ";
//$sql_common .= ", mb_nick_date = '' "; // 0000-00-00
$sql_common .= ", mb_email = '{$row['email']}' ";
//$sql_common .= ", mb_homepage = '' ";
$sql_common .= ", mb_level = '2' ";
//$sql_common .= ", mb_sex = '' "; // 남자: M , 여자: F
//$sql_common .= ", mb_birth = '' ";
$sql_common .= ", mb_tel = '{$row['tel1']}' ";
//$sql_common .= ", mb_hp = '' ";
$sql_common .= ", mb_certify = '' ";
$sql_common .= ", mb_adult = '0' ";
//$sql_common .= ", mb_dupinfo = '' ";
//$sql_common .= ", mb_zip1 = '' "; 3byte
//$sql_common .= ", mb_zip2 = '' "; 3byte
//$sql_common .= ", mb_addr1 = '' ";
//$sql_common .= ", mb_addr2 = '' ";
//$sql_common .= ", mb_addr3 = '' ";
//$sql_common .= ", mb_addr_jibeon = '' ";
//$sql_common .= ", mb_signature = '' ";
//$sql_common .= ", mb_recommend = '' ";
//$sql_common .= ", mb_point = '' ";
//$sql_common .= ", mb_today_login = '' ";
//$sql_common .= ", mb_login_ip = '' ";
$sql_common .= ", mb_datetime = '{$row['wdate']}' "; // 0000-00-00 00:00:00
//$sql_common .= ", mb_ip = '' "; // 1.2.3.4
//$sql_common .= ", mb_leave_date = '' "; // 00000000
//$sql_common .= ", mb_intercept_date = '' "; // 00000000
//$sql_common .= ", mb_email_certify = '' "; // 0000-00-00 00:00:00
//$sql_common .= ", mb_email_certify2 = '' ";
//$sql_common .= ", mb_memo = '' ";
//$sql_common .= ", mb_lost_certify = '' "; = '' ";
if ($row['mailing']=="yes")
$sql_common .= ", mb_mailling = '1' ";
$sql_common .= ", mb_sms = '0' ";
$sql_common .= ", mb_open = '0' ";
$sql_common .= ", mb_open_date = '0000-00-00' ";
//$sql_common .= ", mb_1 = '' ";
//$sql_common .= ", mb_2 = '' ";
//$sql_common .= ", mb_3 = '' ";
//$sql_common .= ", mb_4 = '' ";
//$sql_common .= ", mb_5 = '' ";
//$sql_common .= ", mb_6 = '' ";
//$sql_common .= ", mb_7 = '' ";
//$sql_common .= ", mb_8 = '' ";
//$sql_common .= ", mb_9 = '' ";
//$sql_common .= ", mb_10 = '' ";
$sql2 = " INSERT INTO {$g5['member_table']} SET {$sql_common} ";
//echo $sql2."<br>";
sql_query($sql2);
}
echo '</ol>'.PHP_EOL;
echo '<div id="run_msg">DB 데이터 이전 완료</div>'.PHP_EOL;
?>
</div>
</div>
<hr>
<script>
$(function() {
// 폰트 리사이즈 쿠키있으면 실행
font_resize("container", get_cookie("ck_font_resize_rmv_class"), get_cookie("ck_font_resize_add_class"));
});
</script>
</body>
</html>
독립적으로 제작된 회원 테이블의 자료를 그누보드5 의 자료로 복제하는 로직입니다.
동일한 아이디를 제외하고 그외 것들만 복제합니다.
<?php
include_once('./_common.php');
ob_end_clean();
include_once(G5_LIB_PATH.'/connect.lib.php');
include_once(G5_LIB_PATH.'/outlogin.lib.php');
set_time_limit ( 0 );
ini_set('memory_limit', '50M');
echo '<link rel="stylesheet" href="'.G5_CSS_URL.'/default.css">';
if($is_admin != 'super')
alert('최고관리자로 로그인 후 실행해 주십시오.', G5_URL);
$is_euckr = false;
?>
<style>
#g4_import_run {}
#g4_import_run ol {margin: 0;padding: 0 0 0 25px;border: 1px solid #E9E9E9;border-bottom: 0;background: #f5f8f9;list-style:none;zoom:1}
#g4_import_run li {padding:7px 10px;border-bottom:1px solid #e9e9e9}
#g4_import_run #run_msg {padding:30px 0;text-align:center}
</style>
<div id="hd">
<div id="hd_wrapper">
<div id="logo">
<a href="<?php echo G5_URL ?>"><img src="<?php echo G5_IMG_URL ?>/logo.jpg" alt="<?php echo $config['cf_title']; ?>"></a>
</div>
<ul id="tnb">
<?php if ($is_member) { ?>
<?php if ($is_admin) { ?>
<li><a href="<?php echo G5_ADMIN_URL ?>"><b>관리자</b></a></li>
<?php } ?>
<li><a href="<?php echo G5_BBS_URL ?>/member_confirm.php?url=<?php echo G5_BBS_URL ?>/register_form.php">정보수정</a></li>
<li><a href="<?php echo G5_BBS_URL ?>/logout.php">로그아웃</a></li>
<?php } else { ?>
<li><a href="<?php echo G5_BBS_URL ?>/register.php">회원가입</a></li>
<li><a href="<?php echo G5_BBS_URL ?>/login.php"><b>로그인</b></a></li>
<?php } ?>
</ul>
</div>
</div>
<hr>
<div id="wrapper">
<div id="g4_import_run">
<ol>
<?php
// 우편번호 mb_zip1 의 속성을 3byte 에서 7byte 로 변경
sql_query(" ALTER TABLE {$g5['member_table']} modify mb_zip1 varchar(7) NOT NULL DEFAULT '' ", true);
// 원본 테이블을 가져옵니다.
$sql = " select * from member order by idx asc";
$result = sql_query($sql);
for($i=0; $row=sql_fetch_array($result); $i++) {
// 중복체크
$sql2 = " select count(*) as cnt from {$g5['member_table']} where mb_id = '{$row['id']}' ";
$row2 = sql_fetch($sql2);
if($row2['cnt'])
continue;
// 닉네임 중복체크
$sql2 = " select count(*) as cnt from {$g5['member_table']} where mb_nick = '{$row['name']}' ";
$row2 = sql_fetch($sql2);
if($row2['cnt'])
$mb_nick = $row['name'].strtotime(date($row['wdate'])); // 닉네임 중복되면 뒤에 timestamp 를 추가시킴
$sql_common = " mb_id = '{$row['id']}' ";
$sql_common .= ", mb_password = '".sql_password($row['pwd'])."' ";
$sql_common .= ", mb_name = '{$row['name']}' ";
$sql_common .= ", mb_nick = '{$mb_nick}' ";
//$sql_common .= ", mb_nick_date = '' "; // 0000-00-00
$sql_common .= ", mb_email = '{$row['email']}' ";
//$sql_common .= ", mb_homepage = '' ";
$sql_common .= ", mb_level = '2' ";
//$sql_common .= ", mb_sex = '' "; // 남자: M , 여자: F
//$sql_common .= ", mb_birth = '' ";
$sql_common .= ", mb_tel = '{$row['tel1']}' ";
//$sql_common .= ", mb_hp = '' ";
$sql_common .= ", mb_certify = '' ";
$sql_common .= ", mb_adult = '0' ";
//$sql_common .= ", mb_dupinfo = '' ";
//$sql_common .= ", mb_zip1 = '' "; 3byte
//$sql_common .= ", mb_zip2 = '' "; 3byte
//$sql_common .= ", mb_addr1 = '' ";
//$sql_common .= ", mb_addr2 = '' ";
//$sql_common .= ", mb_addr3 = '' ";
//$sql_common .= ", mb_addr_jibeon = '' ";
//$sql_common .= ", mb_signature = '' ";
//$sql_common .= ", mb_recommend = '' ";
//$sql_common .= ", mb_point = '' ";
//$sql_common .= ", mb_today_login = '' ";
//$sql_common .= ", mb_login_ip = '' ";
$sql_common .= ", mb_datetime = '{$row['wdate']}' "; // 0000-00-00 00:00:00
//$sql_common .= ", mb_ip = '' "; // 1.2.3.4
//$sql_common .= ", mb_leave_date = '' "; // 00000000
//$sql_common .= ", mb_intercept_date = '' "; // 00000000
//$sql_common .= ", mb_email_certify = '' "; // 0000-00-00 00:00:00
//$sql_common .= ", mb_email_certify2 = '' ";
//$sql_common .= ", mb_memo = '' ";
//$sql_common .= ", mb_lost_certify = '' "; = '' ";
if ($row['mailing']=="yes")
$sql_common .= ", mb_mailling = '1' ";
$sql_common .= ", mb_sms = '0' ";
$sql_common .= ", mb_open = '0' ";
$sql_common .= ", mb_open_date = '0000-00-00' ";
//$sql_common .= ", mb_1 = '' ";
//$sql_common .= ", mb_2 = '' ";
//$sql_common .= ", mb_3 = '' ";
//$sql_common .= ", mb_4 = '' ";
//$sql_common .= ", mb_5 = '' ";
//$sql_common .= ", mb_6 = '' ";
//$sql_common .= ", mb_7 = '' ";
//$sql_common .= ", mb_8 = '' ";
//$sql_common .= ", mb_9 = '' ";
//$sql_common .= ", mb_10 = '' ";
$sql2 = " INSERT INTO {$g5['member_table']} SET {$sql_common} ";
//echo $sql2."<br>";
sql_query($sql2);
}
echo '</ol>'.PHP_EOL;
echo '<div id="run_msg">DB 데이터 이전 완료</div>'.PHP_EOL;
?>
</div>
</div>
<hr>
<script>
$(function() {
// 폰트 리사이즈 쿠키있으면 실행
font_resize("container", get_cookie("ck_font_resize_rmv_class"), get_cookie("ck_font_resize_add_class"));
});
</script>
</body>
</html>
댓글목록
등록된 댓글이 없습니다.