sms 인증번호 보내기
sms 인증번호를 보내기 위한 소스
1. g5_passwd_auth 테이들 생성
// 테이블 : g5_passwd_auth
// auth_id 구분번호
// name 이름
// phone 휴대폰번호
// auth_no 인증번호
// wdate 날짜
//
2. 이름과 휴대전화번호를 받는 폼 작성,
3. action 은 아래의 소스로 받아서 처리
4. sms 관리/전송기록에는 기록하지 않습니다.
====================================
<form name="fform" action="" method="post" autocomplete="off">
<label for="mb_auth_num">이 름 <strong class="sound_only">필수</strong></label>
<input type="text" name="mb_auth_name" id="mb_auth_name" class="frm_input" style="width:100px;">
<br /><br />
<label for="mb_auth_phone">휴대폰번호 <strong class="sound_only">필수</strong></label>
<input type="text" name="mb_auth_phone" id="mb_auth_phone" class="frm_input" style="width:100px;">
<input type="button" name="btnPhone" value=" 인증번호 발송 " onclick="authSend();">
<span id="span_phone"></span>
</form>
<script>
function authSend() {
f = document.fform;
name = f.mb_auth_name.value;
phone = f.mb_auth_phone.value;
url = "/theme/jejubbs_com/skin/member/basic/password_lost_phone.send.php";
$.post(url, {"mb_auth_name":name, "mb_auth_phone":phone}, function (data) {
$("#span_phone").html(data);
});
}
</script>
================================
<?php
include_once ("../../../../../common.php");
include_once(G5_SMS5_PATH.'/sms5.lib.php');
$mb_auth_name = $_POST["mb_auth_name"];
if (!$mb_auth_name) {
echo "이름을 입력하세요.";
exit;
}
$mb_auth_phone = $_POST["mb_auth_phone"];
$mb_auth_phone = get_hp($mb_auth_phone, 0); // 받는 사람 휴대전화번호
if (!$mb_auth_phone) {
echo "전화번호를 입력하세요.";
}
$mb_auth_no = mt_rand(100000, 999999); // 100000 ~ 999999 : 6자리 임의의 숫자 만들기
$reply_phone = get_hp($sms5["cf_phone"], 0); // 보내는 사람 휴대전화번호
// 이름과 전화번호를 검색해서 존재하는지 체크
$sql = " select * from g5_member where mb_name = '" . $mb_auth_name . "' and replace(mb_hp, '-', '') = '" . $mb_auth_phone . "' ";
$row = sql_fetch($sql);
if ($mb_auth_name == $row["mb_name"] and $mb_auth_phone == str_replace("-", "", $row["mb_hp"]) ) {
// g5_passwd_auth 테이블에서
// 해당이름과 전화번호로 되어 있는 인증 번호는 모두 삭제한다.
$sql = " delete from g5_passwd_auth where name = '" . $mb_auth_name . "' and phone = '" . $mb_auth_phone . "' ";
sql_query($sql);
// 인증번호 기억하기
$sql = " insert into g5_passwd_auth (name, phone, auth_no, wdate) values (
'$mb_auth_name'
, '$mb_auth_phone'
, '$mb_auth_no'
, NOW()
)";
sql_query($sql);
$SMS = new SMS5;
$SMS->SMS_con($config['cf_icode_server_ip'], $config['cf_icode_id'], $config['cf_icode_pw'], $config['cf_icode_server_port']);
$list = array();
array_push($list, array('bk_hp' => $mb_auth_phone, 'bk_name' => $mb_auth_name));
$result = $SMS->Add2($list, $reply_phone, '', '', "인증번호 " . $mb_auth_no, '', 1);
if ($result) {
$result = $SMS->Send();
if ($result) { //SMS 서버에 접속했습니다.
$SMS->Init(); // 보관하고 있던 결과값을 지웁니다.
echo " 발송완료 (" . date("Y-m-d Y:h:s") . ") ";
} else {
win_close_alert("에러: SMS 서버와 통신이 불안정합니다.");
}
} else {
echo $result;
}
} else {
echo " 일치하는 정보가 존재하지 않습니다.";
}
?>
1. g5_passwd_auth 테이들 생성
// 테이블 : g5_passwd_auth
// auth_id 구분번호
// name 이름
// phone 휴대폰번호
// auth_no 인증번호
// wdate 날짜
//
2. 이름과 휴대전화번호를 받는 폼 작성,
3. action 은 아래의 소스로 받아서 처리
4. sms 관리/전송기록에는 기록하지 않습니다.
====================================
<form name="fform" action="" method="post" autocomplete="off">
<label for="mb_auth_num">이 름 <strong class="sound_only">필수</strong></label>
<input type="text" name="mb_auth_name" id="mb_auth_name" class="frm_input" style="width:100px;">
<br /><br />
<label for="mb_auth_phone">휴대폰번호 <strong class="sound_only">필수</strong></label>
<input type="text" name="mb_auth_phone" id="mb_auth_phone" class="frm_input" style="width:100px;">
<input type="button" name="btnPhone" value=" 인증번호 발송 " onclick="authSend();">
<span id="span_phone"></span>
</form>
<script>
function authSend() {
f = document.fform;
name = f.mb_auth_name.value;
phone = f.mb_auth_phone.value;
url = "/theme/jejubbs_com/skin/member/basic/password_lost_phone.send.php";
$.post(url, {"mb_auth_name":name, "mb_auth_phone":phone}, function (data) {
$("#span_phone").html(data);
});
}
</script>
================================
<?php
include_once ("../../../../../common.php");
include_once(G5_SMS5_PATH.'/sms5.lib.php');
$mb_auth_name = $_POST["mb_auth_name"];
if (!$mb_auth_name) {
echo "이름을 입력하세요.";
exit;
}
$mb_auth_phone = $_POST["mb_auth_phone"];
$mb_auth_phone = get_hp($mb_auth_phone, 0); // 받는 사람 휴대전화번호
if (!$mb_auth_phone) {
echo "전화번호를 입력하세요.";
}
$mb_auth_no = mt_rand(100000, 999999); // 100000 ~ 999999 : 6자리 임의의 숫자 만들기
$reply_phone = get_hp($sms5["cf_phone"], 0); // 보내는 사람 휴대전화번호
// 이름과 전화번호를 검색해서 존재하는지 체크
$sql = " select * from g5_member where mb_name = '" . $mb_auth_name . "' and replace(mb_hp, '-', '') = '" . $mb_auth_phone . "' ";
$row = sql_fetch($sql);
if ($mb_auth_name == $row["mb_name"] and $mb_auth_phone == str_replace("-", "", $row["mb_hp"]) ) {
// g5_passwd_auth 테이블에서
// 해당이름과 전화번호로 되어 있는 인증 번호는 모두 삭제한다.
$sql = " delete from g5_passwd_auth where name = '" . $mb_auth_name . "' and phone = '" . $mb_auth_phone . "' ";
sql_query($sql);
// 인증번호 기억하기
$sql = " insert into g5_passwd_auth (name, phone, auth_no, wdate) values (
'$mb_auth_name'
, '$mb_auth_phone'
, '$mb_auth_no'
, NOW()
)";
sql_query($sql);
$SMS = new SMS5;
$SMS->SMS_con($config['cf_icode_server_ip'], $config['cf_icode_id'], $config['cf_icode_pw'], $config['cf_icode_server_port']);
$list = array();
array_push($list, array('bk_hp' => $mb_auth_phone, 'bk_name' => $mb_auth_name));
$result = $SMS->Add2($list, $reply_phone, '', '', "인증번호 " . $mb_auth_no, '', 1);
if ($result) {
$result = $SMS->Send();
if ($result) { //SMS 서버에 접속했습니다.
$SMS->Init(); // 보관하고 있던 결과값을 지웁니다.
echo " 발송완료 (" . date("Y-m-d Y:h:s") . ") ";
} else {
win_close_alert("에러: SMS 서버와 통신이 불안정합니다.");
}
} else {
echo $result;
}
} else {
echo " 일치하는 정보가 존재하지 않습니다.";
}
?>
댓글 6개
힐링은바다로
8년 전
감사합니다..필요했었는데..^^
meet100
8년 전
ss
8년 전
인증번호 받은 번호가 몇번인지 인증완료되면 한번더 불러올수 있는 방법이 있나요?
7년 전
select name, phone, auth_no, wdate from g5_passwd_auth
where (name='이름' and phone='전화번호')
where (name='이름' and phone='전화번호')
7년 전
인증번호 감사합니다
6년 전
sms인증번호 보내기 소스
게시판 목록
그누보드5 팁자료실
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 공지 | 3년 전 | 4443 | ||
| 2514 | 1년 전 | 905 | ||
| 2513 |
베리소프트
|
1년 전 | 623 | |
| 2512 |
|
1년 전 | 954 | |
| 2511 |
|
1년 전 | 1083 | |
| 2510 | 1년 전 | 1010 | ||
| 2509 | 1년 전 | 1062 | ||
| 2508 | 1년 전 | 1313 | ||
| 2507 | 1년 전 | 690 | ||
| 2506 | 1년 전 | 1255 | ||
| 2505 |
|
1년 전 | 1214 | |
| 2504 | 1년 전 | 1414 | ||
| 2503 | 1년 전 | 949 | ||
| 2502 | 1년 전 | 1075 | ||
| 2501 | 1년 전 | 1175 | ||
| 2500 |
welcome
|
1년 전 | 1083 | |
| 2499 |
하늘그루터기
|
1년 전 | 877 | |
| 2498 | 1년 전 | 1183 | ||
| 2497 | 1년 전 | 648 | ||
| 2496 | 1년 전 | 971 | ||
| 2495 |
|
1년 전 | 1422 | |
| 2494 | 1년 전 | 951 | ||
| 2493 | 1년 전 | 950 | ||
| 2492 | 1년 전 | 1161 | ||
| 2491 | 1년 전 | 1122 | ||
| 2490 | 1년 전 | 1096 | ||
| 2489 | 1년 전 | 1028 | ||
| 2488 | 1년 전 | 780 | ||
| 2487 |
|
1년 전 | 1217 | |
| 2486 | 1년 전 | 835 | ||
| 2485 | 1년 전 | 1010 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기