회원가입시 휴대폰번호 중복 체크를 위한 코드 추가
This commit is contained in:
10
bbs/ajax.mb_hp.php
Normal file
10
bbs/ajax.mb_hp.php
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<?
|
||||||
|
include_once('./_common.php');
|
||||||
|
include_once(G4_LIB_PATH.'/register.lib.php');
|
||||||
|
|
||||||
|
$mb_hp = escape_trim($_POST['reg_mb_hp']);
|
||||||
|
$mb_id = escape_trim($_POST['reg_mb_id']);
|
||||||
|
|
||||||
|
if ($msg = valid_mb_hp($mb_hp)) die($msg);
|
||||||
|
if ($msg = exist_mb_hp($mb_hp, $mb_id)) die($msg);
|
||||||
|
?>
|
||||||
@ -52,3 +52,22 @@ var reg_mb_email_check = function() {
|
|||||||
});
|
});
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var reg_mb_hp_check = function() {
|
||||||
|
var result = "";
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: g4_bbs_url+"/ajax.mb_hp.php",
|
||||||
|
data: {
|
||||||
|
"reg_mb_hp": $("#reg_mb_hp").val(),
|
||||||
|
"reg_mb_id": encodeURIComponent($("#reg_mb_id").val())
|
||||||
|
},
|
||||||
|
cache: false,
|
||||||
|
async: false,
|
||||||
|
success: function(data) {
|
||||||
|
result = data;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return result;
|
||||||
|
}
|
||||||
@ -143,5 +143,35 @@ function valid_mb_name($mb_name)
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function valid_mb_hp($reg_mb_hp)
|
||||||
|
{
|
||||||
|
$reg_mb_hp = preg_replace("/[^0-9]/", "", $reg_mb_hp);
|
||||||
|
if(!$reg_mb_hp)
|
||||||
|
return "핸드폰번호를 올바르게 입력해 주십시오.";
|
||||||
|
else
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
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 "핸드폰번호를 올바르게 입력해 주십시오.";
|
||||||
|
|
||||||
|
$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);
|
||||||
|
|
||||||
|
if($row['cnt'])
|
||||||
|
return "이미 사용 중인 핸드폰번호입니다.";
|
||||||
|
else
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
?>
|
?>
|
||||||
@ -302,6 +302,16 @@ function fregisterform_submit(f)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 휴대폰번호 검사
|
||||||
|
if ((f.w.value == "") || (f.w.value == "u" && f.mb_hp.defaultValue != f.mb_hp.value)) {
|
||||||
|
var msg = reg_mb_hp_check();
|
||||||
|
if (msg) {
|
||||||
|
alert(msg);
|
||||||
|
f.reg_mb_hp.select();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 휴대폰인증 검사
|
// 휴대폰인증 검사
|
||||||
if(f.kcpcert_time.value == "") {
|
if(f.kcpcert_time.value == "") {
|
||||||
alert("휴대폰 본인인증을 해주세요.");
|
alert("휴대폰 본인인증을 해주세요.");
|
||||||
|
|||||||
@ -3,25 +3,17 @@ if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
|||||||
|
|
||||||
// 자신만의 코드를 넣어주세요.
|
// 자신만의 코드를 넣어주세요.
|
||||||
|
|
||||||
// 핸드폰번호 중복체크
|
// 핸드폰번호 체크
|
||||||
$reg_hp = preg_replace("/[^0-9]/", "", $mb_hp);
|
if ($msg = valid_mb_hp($mb_hp)) alert($msg, "", true, true);
|
||||||
if(!$reg_hp)
|
if ($msg = exist_mb_hp($mb_hp, $mb_id)) alert($msg, "", true, true);
|
||||||
alert('핸드폰번호를 입력해 주세요.', "", true, true);
|
|
||||||
|
|
||||||
|
$reg_hp = preg_replace("/[^0-9]/", "", $mb_hp);
|
||||||
$hp_len = strlen($reg_hp);
|
$hp_len = strlen($reg_hp);
|
||||||
|
|
||||||
if($hp_len == 10)
|
if($hp_len == 10)
|
||||||
$reg_mb_hp = preg_replace("/([0-9]{3})([0-9]{3})([0-9]{4})/", "\\1-\\2-\\3", $reg_hp);
|
$reg_mb_hp = preg_replace("/([0-9]{3})([0-9]{3})([0-9]{4})/", "\\1-\\2-\\3", $reg_hp);
|
||||||
else if($hp_len == 11)
|
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_mb_hp = preg_replace("/([0-9]{3})([0-9]{4})([0-9]{4})/", "\\1-\\2-\\3", $reg_hp);
|
||||||
else
|
|
||||||
alert('핸드폰번호가 올바르지 않습니다.', "", true, true);
|
|
||||||
|
|
||||||
$sql2 = " select count(*) as cnt from {$g4['member_table']}
|
|
||||||
where mb_hp = '$reg_mb_hp' and mb_id <> '$mb_id' and mb_leave_date = '' ";
|
|
||||||
$row2 = sql_fetch($sql2);
|
|
||||||
if($row2['cnt'])
|
|
||||||
alert('입력하신 핸드폰번호는 다른 회원님이 사용 중입니다.', "", true, true);
|
|
||||||
|
|
||||||
/* ======================================================================================================= */
|
/* ======================================================================================================= */
|
||||||
/* = 휴대폰인증 및 성인인증 = */
|
/* = 휴대폰인증 및 성인인증 = */
|
||||||
|
|||||||
Reference in New Issue
Block a user