휴대폰 번호 만들기를 hyphen_hp_number 함수로 처리
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
$sub_menu = "200100";
|
||||
include_once('./_common.php');
|
||||
include_once("./_common.php");
|
||||
include_once(G4_LIB_PATH."/register.lib.php");
|
||||
|
||||
if ($w == 'u')
|
||||
check_demo();
|
||||
@ -13,27 +14,14 @@ if ($member['mb_password'] != sql_password($_POST['admin_password'])) {
|
||||
alert('패스워드가 다릅니다.');
|
||||
}
|
||||
|
||||
$mb_id = mysql_real_escape_string(trim($_POST['mb_id']));
|
||||
$mb_id = escape_trim($_POST['mb_id']);
|
||||
|
||||
// 핸드폰번호 체크
|
||||
$mb_hp = $_POST['mb_hp'];
|
||||
if($mb_hp) {
|
||||
$mb_hp = preg_replace("/[^0-9]/", "", $mb_hp);
|
||||
$hp_len = strlen($mb_hp);
|
||||
if($hp_len == 10) {
|
||||
$mb_hp = preg_replace("/([0-9]{3})([0-9]{3})([0-9]{4})/", "\\1-\\2-\\3", $mb_hp);
|
||||
} else if($hp_len == 11) {
|
||||
$mb_hp = preg_replace("/([0-9]{3})([0-9]{4})([0-9]{4})/", "\\1-\\2-\\3", $mb_hp);
|
||||
} else {
|
||||
alert('핸드폰번호를 올바르게 입력해 주십시오.');
|
||||
}
|
||||
|
||||
// 중복체크
|
||||
$sql = " select count(*) as cnt from {$g4['member_table']} where mb_hp = '$mb_hp' and mb_id <> '$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']}',
|
||||
|
||||
@ -1969,4 +1969,12 @@ function html_end()
|
||||
}
|
||||
return preg_replace('#(</title>)#', "$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);
|
||||
}
|
||||
?>
|
||||
@ -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);
|
||||
|
||||
@ -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);
|
||||
|
||||
/* ======================================================================================================= */
|
||||
/* = 휴대폰인증 및 성인인증 = */
|
||||
|
||||
@ -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);
|
||||
?>
|
||||
|
||||
<script>
|
||||
|
||||
Reference in New Issue
Block a user