휴대폰 번호 만들기를 hyphen_hp_number 함수로 처리

This commit is contained in:
gnuboard
2013-04-26 13:53:25 +09:00
parent ba2874565c
commit da3c09523c
5 changed files with 49 additions and 71 deletions

View File

@ -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);
}
?>

View File

@ -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);