다음 주소 API 적용 및 기타 수정

This commit is contained in:
chicpro
2014-08-19 14:52:47 +09:00
parent 43fae4ed50
commit 59468d1312
18 changed files with 200 additions and 463 deletions

View File

@ -28,16 +28,19 @@ if (!$mb['mb_id'])
else if (is_admin($mb['mb_id']))
alert('관리자 아이디는 접근 불가합니다.');
// 난수
srand(time());
// 임시비밀번호
$change_password = rand(100000, 999999);
$mb_lost_certify = sql_password($change_password);
$mb_datetime = sql_password($mb['mb_datetime']);
$sql = " update {$g5['member_table']} set mb_lost_certify = '$mb_lost_certify' where mb_id = '{$mb['mb_id']}' ";
// 어떠한 회원정보도 포함되지 않은 일회용 난수를 생성하여 인증에 사용
$mb_nonce = bin2hex(pack('V*', rand(), rand(), rand(), rand()));
// 임시비밀번호와 난수를 mb_lost_certify 필드에 저장
$sql = " update {$g5['member_table']} set mb_lost_certify = '$mb_nonce $mb_lost_certify' where mb_id = '{$mb['mb_id']}' ";
sql_query($sql);
$href = G5_BBS_URL.'/password_lost_certify.php?mb_no='.$mb['mb_no'].'&mb_datetime='.$mb_datetime.'&mb_lost_certify='.$mb_lost_certify;
// 인증 링크 생성
$href = G5_BBS_URL.'/password_lost_certify.php?mb_no='.$mb['mb_no'].'&mb_nonce='.$mb_nonce;
$subject = "[".$config['cf_title']."] 요청하신 회원정보 찾기 안내 메일입니다.";
@ -69,4 +72,4 @@ $content .= '</div>';
mailer($config['cf_admin_email_name'], $config['cf_admin_email'], $mb['mb_email'], $subject, $content, 1);
alert_close($email.' 메일로 회원아이디와 비밀번호를 인증할 수 있는 메일이 발송 되었습니다.\\n\\n메일을 확인하여 주십시오.');
?>
?>

View File

@ -4,24 +4,24 @@ include_once('./_common.php');
// 오류시 공히 Error 라고 처리하는 것은 회원정보가 있는지? 비밀번호가 틀린지? 를 알아보려는 해킹에 대비한것
$mb_no = trim($_GET['mb_no']);
$mb_datetime = trim($_GET['mb_datetime']);
$mb_lost_certify = trim($_GET['mb_lost_certify']);
$mb_nonce = trim($_GET['mb_nonce']);
// 회원아이디가 아닌 회원고유번호로 회원정보를 구한다.
$sql = " select mb_id, mb_datetime, mb_lost_certify from {$g5['member_table']} where mb_no = '$mb_no' ";
$sql = " select mb_id, mb_lost_certify from {$g5['member_table']} where mb_no = '$mb_no' ";
$mb = sql_fetch($sql);
if (!trim($mb['mb_lost_certify']))
if (strlen($mb['mb_lost_certify']) < 33)
die("Error");
// 인증 링크는 한번만 처리가 되게 한다.
sql_query(" update {$g5['member_table']} set mb_lost_certify = '' where mb_no = '$mb_no' ");
// 변경될 비밀번호가 넘어와야하고 저장된 변경비밀번호를 md5 로 변환하여 같으면 정상
if ($mb_lost_certify && $mb_datetime === sql_password($mb['mb_datetime']) && $mb_lost_certify === $mb['mb_lost_certify']) {
sql_query(" update {$g5['member_table']} set mb_password = '{$mb['mb_lost_certify']}' where mb_no = '$mb_no' ");
// 인증을 위한 난수가 제대로 넘어온 경우 임시비밀번호를 실제 비밀번호로 바꿔준다.
if ($mb_nonce === substr($mb['mb_lost_certify'], 0, 32)) {
$new_password_hash = substr($mb['mb_lost_certify'], 33);
sql_query(" update {$g5['member_table']} set mb_password = '$new_password_hash' where mb_no = '$mb_no' ");
alert('비밀번호가 변경됐습니다.\\n\\n회원아이디와 변경된 비밀번호로 로그인 하시기 바랍니다.', G5_BBS_URL.'/login.php');
}
else {
die("Error");
}
?>
?>

View File

@ -110,6 +110,13 @@ if ($w == '' || $w == 'u') {
if ($msg = exist_mb_email($mb_email, $mb_id)) alert($msg, "", true, true);
}
$mb_zip1 = preg_replace('/[^0-9]/', '', $mb_zip1);
$mb_zip2 = preg_replace('/[^0-9]/', '', $mb_zip2);
$mb_addr1 = clean_xss_tags($mb_addr1);
$mb_addr2 = clean_xss_tags($mb_addr2);
$mb_addr3 = clean_xss_tags($mb_addr3);
$mb_addr_jibeon = preg_match("/^(N|R)$/", $mb_addr_jibeon) ? $mb_addr_jibeon : '';
// 사용자 코드 실행
@include_once($member_skin_path.'/register_form_update.head.skin.php');

View File

@ -1,72 +1,15 @@
<?php
include_once('./_common.php');
// 메모리를 많이 잡아먹어서 아래의 코드로 대체
//ini_set('memory_limit', '20M');
//$zipfile = file("./zip.db");
/*
$zipfile = array();
$fp = fopen('./zip.db', 'r');
while(!feof($fp)) {
$zipfile[] = fgets($fp, 4096);
}
fclose($fp);
$search_count = 0;
if ($addr1)
{
while ($zipcode = each($zipfile))
{
if(strstr(substr($zipcode[1],9,512), $addr1))
{
$list[$search_count][zip1] = substr($zipcode[1],0,3);
$list[$search_count][zip2] = substr($zipcode[1],4,3);
$addr = explode(" ", substr($zipcode[1],8));
if ($addr[sizeof($addr)-1])
{
$list[$search_count][addr] = str_replace($addr[sizeof($addr)-1], "", substr($zipcode[1],8));
$list[$search_count][bunji] = trim($addr[sizeof($addr)-1]);
}
else
$list[$search_count][addr] = substr($zipcode[1],8);
$list[$search_count][encode_addr] = urlencode($list[$search_count][addr]);
$search_count++;
}
}
if (!$search_count) alert('찾으시는 주소가 없습니다.');
}
*/
/* 기존의 DB에서 불러오는 방식
if ($addr1)
{
//$sql = " select * from $g5[zip_table] where zp_dong like '%$addr1%' order by zp_id ";
$sql = " select * from $g5[zip_table] where zp_dong like '%$addr1%' order by zp_sido, zp_gugun, zp_dong ";
$result = sql_query($sql);
$search_count = 0;
for ($i=0; $row=sql_fetch_array($result); $i++)
{
$list[$i][zip1] = substr($row[zp_code], 0, 3);
$list[$i][zip2] = substr($row[zp_code], 3, 3);
$list[$i][addr] = "$row[zp_sido] $row[zp_gugun] $row[zp_dong]";
$list[$i][bunji] = $row[zp_bunji];
$list[$i][encode_addr] = urlencode($list[$i][addr]);
$search_count++;
}
if (!$search_count)
alert("찾으시는 주소가 없습니다.");
}
*/
$g5['title'] = '우편번호 검색';
include_once(G5_PATH.'/head.sub.php');
if(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']=='on') { //https 통신
echo '<script src="https://spi.maps.daum.net/imap/map_js_init/postcode.js"></script>';
} else { //http 통신
echo '<script src="http://dmaps.daum.net/map_js_init/postcode.js"></script>';
}
include_once($member_skin_path.'/zip.skin.php');
include_once(G5_PATH.'/tail.sub.php');