$count = 0; $hp_yes = 0; $hp_no = 0; $hp_empty = 0; $leave = 0; $receipt = 0; // 회원 데이터 마이그레이션 $qry = sql_query("select mb_id, mb_name, mb_hp, mb_sms, mb_leave_date from " . $g5['member_table'] . " order by mb_datetime"); while ($res = sql_fetch_array($qry)) { if ($res['mb_leave_date'] != '') { $leave++; } else { if ($res['mb_hp'] == '') { $hp_empty++; } else { if (is_hp($res['mb_hp'])) { $hp_yes++; } else { $hp_no++; } } } $hp = get_hp($res['mb_hp']); if ($hp == '') { $bk_receipt = 0; } else { $bk_receipt = $res['mb_sms']; } $field = "mb_id='{$res['mb_id']}', bk_name='" . addslashes($res['mb_name']) . "', bk_hp='{$hp}', bk_receipt='{$bk_receipt}', bk_datetime='" . G5_TIME_YMDHIS . "'"; $res2 = sql_fetch("select * from {$g5['sms5_book_table']} where mb_id='{$res['mb_id']}'"); if ($res2) {
function get_hp($hp, $hyphen = 1) { global $g5; if (!is_hp($hp)) { return ''; } if ($hyphen) { $preg = "\$1-\$2-\$3"; } else { $preg = "\$1\$2\$3"; } $hp = str_replace('-', '', trim($hp)); $hp = preg_replace("/^(01[016789])([0-9]{3,4})([0-9]{4})\$/", $preg, $hp); if ($g5['sms5_demo']) { $hp = '0100000000'; } return $hp; }