From da3c09523cfa3e5eae90dbd9d32c8e3dd671681a Mon Sep 17 00:00:00 2001 From: gnuboard Date: Fri, 26 Apr 2013 13:53:25 +0900 Subject: [PATCH] =?UTF-8?q?=ED=9C=B4=EB=8C=80=ED=8F=B0=20=EB=B2=88?= =?UTF-8?q?=ED=98=B8=20=EB=A7=8C=EB=93=A4=EA=B8=B0=EB=A5=BC=20hyphen=5Fhp?= =?UTF-8?q?=5Fnumber=20=ED=95=A8=EC=88=98=EB=A1=9C=20=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- adm/member_form_update.php | 86 ++++++++++++++------------------ lib/common.lib.php | 8 +++ lib/register.lib.php | 10 +--- plugin/kcp/kcpcert.head.skin.php | 8 +-- plugin/kcp/kcpcert_result.php | 8 +-- 5 files changed, 49 insertions(+), 71 deletions(-) diff --git a/adm/member_form_update.php b/adm/member_form_update.php index d9ce3e2e3..d8f50f95f 100644 --- a/adm/member_form_update.php +++ b/adm/member_form_update.php @@ -1,6 +1,7 @@ '$mb_id' "; - - $row = sql_fetch($sql); - if($row['cnt']) - alert('다른 회원이 사용 중인 핸드폰번호입니다.'); + $result = exist_mb_hp($mb_hp, $mb_id); + if ($result) + alert($result); } -$sql_common = " mb_name = '{$_POST['mb_name']}', - mb_nick = '{$_POST['mb_nick']}', - mb_email = '{$_POST['mb_email']}', - mb_homepage = '{$_POST['mb_homepage']}', - mb_tel = '{$_POST['mb_tel']}', - mb_hp = '$mb_hp', - mb_zip1 = '{$_POST['mb_zip1']}', - mb_zip2 = '{$_POST['mb_zip2']}', - mb_addr1 = '{$_POST['mb_addr1']}', - mb_addr2 = '{$_POST['mb_addr2']}', - mb_birth = '{$_POST['mb_birth']}', - mb_sex = '{$_POST['mb_sex']}', - mb_signature = '{$_POST['mb_signature']}', - mb_leave_date = '{$_POST['mb_leave_date']}', - mb_intercept_date='{$_POST['mb_intercept_date']}', - mb_memo = '{$_POST['mb_memo']}', - mb_mailling = '{$_POST['mb_mailling']}', - mb_sms = '{$_POST['mb_sms']}', - mb_open = '{$_POST['mb_open']}', - mb_profile = '{$_POST['mb_profile']}', - mb_level = '{$_POST['mb_level']}', - mb_1 = '{$_POST['mb_1']}', - mb_2 = '{$_POST['mb_2']}', - mb_3 = '{$_POST['mb_3']}', - mb_4 = '{$_POST['mb_4']}', - mb_5 = '{$_POST['mb_5']}', - mb_6 = '{$_POST['mb_6']}', - mb_7 = '{$_POST['mb_7']}', - mb_8 = '{$_POST['mb_8']}', - mb_9 = '{$_POST['mb_9']}', - mb_10 = '{$_POST['mb_10']}' "; +$sql_common = " mb_name = '{$_POST['mb_name']}', + mb_nick = '{$_POST['mb_nick']}', + mb_email = '{$_POST['mb_email']}', + mb_homepage = '{$_POST['mb_homepage']}', + mb_tel = '{$_POST['mb_tel']}', + mb_hp = '$mb_hp', + mb_zip1 = '{$_POST['mb_zip1']}', + mb_zip2 = '{$_POST['mb_zip2']}', + mb_addr1 = '{$_POST['mb_addr1']}', + mb_addr2 = '{$_POST['mb_addr2']}', + mb_birth = '{$_POST['mb_birth']}', + mb_sex = '{$_POST['mb_sex']}', + mb_signature = '{$_POST['mb_signature']}', + mb_leave_date = '{$_POST['mb_leave_date']}', + mb_intercept_date='{$_POST['mb_intercept_date']}', + mb_memo = '{$_POST['mb_memo']}', + mb_mailling = '{$_POST['mb_mailling']}', + mb_sms = '{$_POST['mb_sms']}', + mb_open = '{$_POST['mb_open']}', + mb_profile = '{$_POST['mb_profile']}', + mb_level = '{$_POST['mb_level']}', + mb_1 = '{$_POST['mb_1']}', + mb_2 = '{$_POST['mb_2']}', + mb_3 = '{$_POST['mb_3']}', + mb_4 = '{$_POST['mb_4']}', + mb_5 = '{$_POST['mb_5']}', + mb_6 = '{$_POST['mb_6']}', + mb_7 = '{$_POST['mb_7']}', + mb_8 = '{$_POST['mb_8']}', + mb_9 = '{$_POST['mb_9']}', + mb_10 = '{$_POST['mb_10']}' "; if ($w == '') { diff --git a/lib/common.lib.php b/lib/common.lib.php index d8a9d283d..3c1cdb67b 100644 --- a/lib/common.lib.php +++ b/lib/common.lib.php @@ -1969,4 +1969,12 @@ function html_end() } return preg_replace('#()#', "$1$stylesheet", $buffer); } + + +// 휴대폰번호의 숫자만 취한 후 중간에 하이픈(-)을 넣는다. +function hyphen_hp_number($hp) +{ + $hp = preg_replace("/[^0-9]/", "", $hp); + return preg_replace("/([0-9]{3})([0-9]{3,4})([0-9]{4})$/", "\\1-\\2-\\3", $hp); +} ?> \ No newline at end of file diff --git a/lib/register.lib.php b/lib/register.lib.php index 6b9eaaf14..85a5d29da 100644 --- a/lib/register.lib.php +++ b/lib/register.lib.php @@ -159,14 +159,8 @@ function valid_mb_hp($reg_mb_hp) function exist_mb_hp($reg_mb_hp, $reg_mb_id) { global $g4; - $reg_mb_hp = preg_replace("/[^0-9]/", "", $reg_mb_hp); - $len = strlen($reg_mb_hp); - if($len == 10) - $reg_mb_hp = preg_replace("/([0-9]{3})([0-9]{3})([0-9]{4})/", "\\1-\\2-\\3", $reg_mb_hp); - else if($len == 11) - $reg_mb_hp = preg_replace("/([0-9]{3})([0-9]{4})([0-9]{4})/", "\\1-\\2-\\3", $reg_mb_hp); - else - return "핸드폰번호를 올바르게 입력해 주십시오."; + + $reg_mb_hp = hyphen_hp_number($reg_mb_hp); $sql = "select count(*) as cnt from {$g4['member_table']} where mb_hp = '$reg_mb_hp' and mb_id <> '$reg_mb_id' "; $row = sql_fetch($sql); diff --git a/plugin/kcp/kcpcert.head.skin.php b/plugin/kcp/kcpcert.head.skin.php index 90a6a85cb..b997e1d87 100644 --- a/plugin/kcp/kcpcert.head.skin.php +++ b/plugin/kcp/kcpcert.head.skin.php @@ -5,13 +5,7 @@ if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가 if ($msg = valid_mb_hp($mb_hp)) alert($msg, "", true, true); if ($msg = exist_mb_hp($mb_hp, $mb_id)) alert($msg, "", true, true); -$reg_hp = preg_replace("/[^0-9]/", "", $mb_hp); -$hp_len = strlen($reg_hp); - -if($hp_len == 10) - $reg_mb_hp = preg_replace("/([0-9]{3})([0-9]{3})([0-9]{4})/", "\\1-\\2-\\3", $reg_hp); -else if($hp_len == 11) - $reg_mb_hp = preg_replace("/([0-9]{3})([0-9]{4})([0-9]{4})/", "\\1-\\2-\\3", $reg_hp); +$reg_hp = hyphen_hp_number($mb_hp); /* ======================================================================================================= */ /* = 휴대폰인증 및 성인인증 = */ diff --git a/plugin/kcp/kcpcert_result.php b/plugin/kcp/kcpcert_result.php index 221d1112e..013d7b3ba 100644 --- a/plugin/kcp/kcpcert_result.php +++ b/plugin/kcp/kcpcert_result.php @@ -163,13 +163,7 @@ else if( $cert_enc_use != "Y" ) $ct_cert->mf_clear(); // 휴대폰번호 포맷변경 -$phone_no = preg_replace("/[^0-9]/", "", $phone_no); -$hp_len = strlen($phone_no); - -if($hp_len == 10) - $phone_no = preg_replace("/([0-9]{3})([0-9]{3})([0-9]{4})/", "\\1-\\2-\\3", $phone_no); -else if($hp_len == 11) - $phone_no = preg_replace("/([0-9]{3})([0-9]{4})([0-9]{4})/", "\\1-\\2-\\3", $phone_no); +$phone_no = hyphen_hp_number($phone_no); ?>