Skip to content
This repository has been archived by the owner on Jun 24, 2021. It is now read-only.

Commit

Permalink
이메일인증 프로세스 개선
Browse files Browse the repository at this point in the history
  • Loading branch information
chicpro committed May 3, 2016
1 parent 363cc1f commit 506e748
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 9 deletions.
5 changes: 5 additions & 0 deletions adm/member_form.php
Expand Up @@ -126,6 +126,11 @@
sql_query(" ALTER TABLE {$g5['member_table']} ADD `mb_dupinfo` varchar(255) NOT NULL DEFAULT '' AFTER `mb_adult` ", false);
}

// 이메일인증 체크 필드추가
if(!isset($mb['mb_email_certify2'])) {
sql_query(" ALTER TABLE {$g5['member_table']} ADD `mb_email_certify2` varchar(255) NOT NULL DEFAULT '' AFTER `mb_email_certify` ", false);
}

if ($mb['mb_intercept_date']) $g5['title'] = "차단된 ";
else $g5['title'] .= "";
$g5['title'] .= '회원 '.$html_title;
Expand Down
15 changes: 12 additions & 3 deletions bbs/email_certify.php
@@ -1,20 +1,29 @@
<?php
include_once('./_common.php');

$sql = " select mb_id, mb_email, mb_datetime from {$g5['member_table']} where mb_id = '{$mb_id}' ";
$mb_id = trim($_GET['mb_id']);
$mb_md5 = trim($_GET['mb_md5']);

$sql = " select mb_id, mb_email_certify2 from {$g5['member_table']} where mb_id = '{$mb_id}' ";
$row = sql_fetch($sql);
if (!$row['mb_id'])
alert('존재하는 회원이 아닙니다.', G5_URL);

// 인증 링크는 한번만 처리가 되게 한다.
sql_query(" update {$g5['member_table']} set mb_email_certify2 = '' where mb_id = '$mb_id' ");

if ($mb_md5)
{
$tmp_md5 = md5($row['mb_id'].$row['mb_email'].$row['mb_datetime']);
if ($mb_md5 == $tmp_md5)
if ($mb_md5 == $row['mb_email_certify2'])
{
sql_query(" update {$g5['member_table']} set mb_email_certify = '".G5_TIME_YMDHIS."' where mb_id = '{$mb_id}' ");

alert("메일인증 처리를 완료 하였습니다.\\n\\n지금부터 {$mb_id} 아이디로 로그인 가능합니다.", G5_URL);
}
else
{
alert('메일인증 요청 정보가 올바르지 않습니다.', G5_URL);
}
}

alert('제대로 된 값이 넘어오지 않았습니다.', G5_URL);
Expand Down
10 changes: 7 additions & 3 deletions bbs/register_email_update.php
Expand Up @@ -9,7 +9,7 @@
if(!$mb_id || !$mb_email)
alert('올바른 방법으로 이용해 주십시오.', G5_URL);

$sql = " select mb_name, mb_password, mb_email, mb_datetime from {$g5['member_table']} where mb_id = '{$mb_id}' and substring(mb_email_certify, 1, 1) = '0' ";
$sql = " select mb_name from {$g5['member_table']} where mb_id = '{$mb_id}' and substring(mb_email_certify, 1, 1) = '0' ";
$mb = sql_fetch($sql);
if (!$mb) {
alert("이미 메일인증 하신 회원입니다.", G5_URL);
Expand All @@ -29,8 +29,12 @@
$subject = '['.$config['cf_title'].'] 인증확인 메일입니다.';

$mb_name = $mb['mb_name'];
$mb_datetime = $mb['mb_datetime'] ? $mb['mb_datetime'] : G5_TIME_YMDHIS;
$mb_md5 = md5($mb_id.$mb_email.$mb_datetime);

// 어떠한 회원정보도 포함되지 않은 일회용 난수를 생성하여 인증에 사용
$mb_md5 = md5(pack('V*', rand(), rand(), rand(), rand()));

sql_query(" update {$g5['member_table']} set mb_email_certify2 = '$mb_md5' where mb_id = '$mb_id' ");

$certify_href = G5_BBS_URL.'/email_certify.php?mb_id='.$mb_id.'&amp;mb_md5='.$mb_md5;

ob_start();
Expand Down
9 changes: 6 additions & 3 deletions bbs/register_form_update.php
Expand Up @@ -396,16 +396,19 @@
if ($config['cf_use_email_certify'] && $old_email != $mb_email) {
$subject = '['.$config['cf_title'].'] 인증확인 메일입니다.';

$mb_datetime = $member['mb_datetime'] ? $member['mb_datetime'] : G5_TIME_YMDHIS;
$mb_md5 = md5($mb_id.$mb_email.$mb_datetime);
// 어떠한 회원정보도 포함되지 않은 일회용 난수를 생성하여 인증에 사용
$mb_md5 = md5(pack('V*', rand(), rand(), rand(), rand()));

sql_query(" update {$g5['member_table']} set mb_email_certify2 = '$mb_md5' where mb_id = '$mb_id' ");

$certify_href = G5_BBS_URL.'/email_certify.php?mb_id='.$mb_id.'&amp;mb_md5='.$mb_md5;

ob_start();
include_once ('./register_form_update_mail3.php');
$content = ob_get_contents();
ob_end_clean();

mailer($config['cf_title'], $config['cf_admin_email'], $mb_email, $subject, $content, 1);
mailer($config['cf_admin_email_name'], $config['cf_admin_email'], $mb_email, $subject, $content, 1);
}


Expand Down

0 comments on commit 506e748

Please sign in to comment.