그누보드 [G5] 회원가입시 성별 / 생년월일 입력받기
페이지 정보
본문
그누보드5 는 회원가입시 성별 받는 양식이 없습니다.
그누보드4에서부터 성별 필드인 mb_sex 가 존재하므로 이것을 이용해서 회원가입시 성별을 받는 방법입니다.
회원가입할때 성별 / 츨생년도(생년월일)을 받고자 할때는
Ⅰ. 그누보드 5.3
1. 그누보드5.3 / skin / member / basic / register_form.skin.php 추가
<li style=" height:0px;">
<div style="width:50%; float:left; height:0px; line-height:35px;">
<label for="reg_mb_sex">성별<strong class="sound_only">필수</strong></label>
<?php
if($member['mb_sex']) { // 본인 성별 변경 금지
echo "<input type=\"hidden\" name=\"mb_sex\" value=\"{$member['mb_sex']}\">";
if ($member['mb_sex']=="M") { echo "남"; } else { echo "여"; }
} else {
?>
<input type="radio" id="reg_mb_sex" name="mb_sex" value="M" <?php echo $member['mb_sex']=="M"?"checked":""; ?>> 남
<input type="radio" id="reg_mb_sex" name="mb_sex" value="F" <?php echo $member['mb_sex']=="F"?"checked":""; ?>> 여
<?php
}
?>
</div>
<div style="width:50%; float:left; height:0px;">
<?php include_once(G5_PLUGIN_PATH.'/jquery-ui/datepicker.php'); ?>
<script>
$(function(){
var dates = $( "#reg_mb_birth" ).datepicker({
changeYear: true, // 년 변경가능
changeMonth: true,
yearRange: "c-99:c+0",
dateFormat: "yymmdd", // 년월일 표시방법 yy-mm-dd 또는 yymmdd
numberOfMonths: 1, // 한눈에 보이는 월달력수
onSelect: function( selectedDate ) {
var option = this.id == "reg_mb_birth" ? "minDate" : "maxDate",
instance = $( this ).data( "datepicker" ),
date = $.datepicker.parseDate(
instance.settings.dateFormat ||
$.datepicker._defaults.dateFormat,
selectedDate, instance.settings );
dates.not( this ).datepicker( "option", option, date );
}
});
});
</script>
<label for="reg_mb_birth" class="sound_only">생년월일</label>
<input type="text" name="mb_birth" value="<?php echo $member['mb_birth'] ?>" id="reg_mb_birth" required readonly class="frm_input full_input required" size="12" maxlength="15" placeholder="생년월일">
</div>
<div style="clear:both;"></div>
</li>
2-1. 그누보드5.3 / bbs / register_form_update.php
if (get_session('ss_check_mb_id') != $mb_id || get_session('ss_check_mb_nick') != $mb_nick || get_session('ss_check_mb_email') != $mb_email) {
set_session('ss_check_mb_id', '');
set_session('ss_check_mb_nick', '');
set_session('ss_check_mb_email', '');
alert('올바른 방법으로 이용해 주십시오.');
}
를 아래와 같이 변경
if (get_session('ss_check_mb_id') != $mb_id || get_session('ss_check_mb_email') != $mb_email) {
//if (get_session('ss_check_mb_id') != $mb_id || get_session('ss_check_mb_nick') != $mb_nick || get_session('ss_check_mb_email') != $mb_email) {
set_session('ss_check_mb_id', '');
//set_session('ss_check_mb_nick', '');
set_session('ss_check_mb_email', '');
alert('올바른 방법으로 이용해 주십시오.');
}
2-2. 그누보드5.3 / bbs / register_form_update.php
if ($config['cf_cert_use'] && $cert_type && $md5_cert_no) {
// 해시값이 같은 경우에만 본인확인 값을 저장한다.
if ($_SESSION['ss_cert_hash'] == md5($mb_name.$cert_type.$_SESSION['ss_cert_birth'].$md5_cert_no)) {
$sql_certify .= " , mb_hp = '{$mb_hp}' ";
$sql_certify .= " , mb_certify = '{$cert_type}' ";
$sql_certify .= " , mb_adult = '{$_SESSION['ss_cert_adult']}' ";
$sql_certify .= " , mb_birth = '{$_SESSION['ss_cert_birth']}' ";
$sql_certify .= " , mb_sex = '{$_SESSION['ss_cert_sex']}' ";
$sql_certify .= " , mb_dupinfo = '{$_SESSION['ss_cert_dupinfo']}' ";
if($w == 'u')
$sql_certify .= " , mb_name = '{$mb_name}' ";
} else {
$sql_certify .= " , mb_hp = '{$mb_hp}' ";
$sql_certify .= " , mb_certify = '' ";
$sql_certify .= " , mb_adult = 0 ";
$sql_certify .= " , mb_birth = '' ";
$sql_certify .= " , mb_sex = '' ";
}
} else {
if (get_session("ss_reg_mb_name") != $mb_name || get_session("ss_reg_mb_hp") != $mb_hp) {
$sql_certify .= " , mb_hp = '{$mb_hp}' ";
$sql_certify .= " , mb_certify = '' ";
$sql_certify .= " , mb_adult = 0 ";
$sql_certify .= " , mb_birth = '' ";
$sql_certify .= " , mb_sex = '' ";
}
}
를 아래와 같이 변경
if ($config['cf_cert_use'] && $cert_type && $md5_cert_no) {
// 해시값이 같은 경우에만 본인확인 값을 저장한다.
if ($_SESSION['ss_cert_hash'] == md5($mb_name.$cert_type.$_SESSION['ss_cert_birth'].$md5_cert_no)) {
$sql_certify .= " , mb_hp = '{$mb_hp}' ";
$sql_certify .= " , mb_certify = '{$cert_type}' ";
$sql_certify .= " , mb_adult = '{$_SESSION['ss_cert_adult']}' ";
$sql_certify .= " , mb_birth = '{$_SESSION['ss_cert_birth']}' ";
$sql_certify .= " , mb_sex = '{$_SESSION['ss_cert_sex']}' ";
$sql_certify .= " , mb_dupinfo = '{$_SESSION['ss_cert_dupinfo']}' ";
if($w == 'u')
$sql_certify .= " , mb_name = '{$mb_name}' ";
} else {
$sql_certify .= " , mb_hp = '{$mb_hp}' ";
$sql_certify .= " , mb_certify = '' ";
$sql_certify .= " , mb_adult = 0 ";
$sql_certify .= " , mb_birth = '{$mb_birth}' "; // 해피정닷컴 수정
$sql_certify .= " , mb_sex = '{$mb_sex}' "; // 해피정닷컴 수정
}
} else {
if (get_session("ss_reg_mb_name") != $mb_name || get_session("ss_reg_mb_hp") != $mb_hp) {
$sql_certify .= " , mb_hp = '{$mb_hp}' ";
$sql_certify .= " , mb_certify = '' ";
$sql_certify .= " , mb_adult = 0 ";
$sql_certify .= " , mb_birth = '{$mb_birth}' "; // 해피정닷컴 수정
$sql_certify .= " , mb_sex = '{$mb_sex}' "; // 해피정닷컴 수정
} else { // 해피정닷컴 추가
$sql_certify .= " , mb_birth = '{$mb_birth}' "; // 해피정닷컴 추가
$sql_certify .= " , mb_sex = '{$mb_sex}' "; // 해피정닷컴 추가
}
}
3. 그누보드5.3 / adm / member_form.php 추가
<tr>
<th scope="row">출생년도</th>
<td>
<?php // https://www.happyjung.com/lecture/2841 참고 ?>
<!--<script src='http://code.jquery.com/jquery-2.1.4.js' type='text/javascript'></script>-->
<script>
$(window).load(function(){
var dob = $('.age').data('age');
var xmlHttp;
function srvTime(){
if (window.XMLHttpRequest) {
xmlHttp = new XMLHttpRequest();
xmlHttp.open('HEAD',window.location.href.toString(),false);
xmlHttp.setRequestHeader("Content-Type", "text/html");
xmlHttp.send('');
return xmlHttp.getResponseHeader("Date");
}else if (window.ActiveXObject) {
xmlHttp = new ActiveXObject('Msxml2.XMLHTTP');
xmlHttp.open('HEAD',window.location.href.toString(),false);
xmlHttp.setRequestHeader("Content-Type", "text/html");
xmlHttp.send('');
return xmlHttp.getResponseHeader("Date");
}
}
var st = srvTime();
if(dob != ''){
var str=dob.split('-');
var today = new Date(st);
var toMonth = today.getMonth()+1;
var toDate = today.getDate();
var toYear = today.getFullYear();
var toAge = toYear - str[0];
if (toMonth > str[1]){
dayDiff = toAge;
} else if (str[1] > toMonth) {
dayDiff = toAge -1;
} else {
if (str[2] > toDate) {
dayDiff =toAge -1;
} else {
var dayDiff = toAge;
}
}
var age = parseInt(dayDiff);
$('.age').html('( ' + toYear + '년 현재 : ' + age + '세 )');
}
});
</script>
<input type="text" name="mb_birth" value="<?php echo $mb['mb_birth']; ?>" class="frm_input" size="15">
<span data-age="<?php echo $mb['mb_birth']; ?>-00-00" class="age"></span>
</td>
<th scope="row">성별</th>
<td>
<input type="radio" id="reg_mb_sex" name="mb_sex" value="M" <?php if($mb['mb_sex'] == 'M') echo 'checked="checked"'; ?>>
<label for="mb_sex_m">남</label>
<input type="radio" id="reg_mb_sex" name="mb_sex" value="F" <?php if($mb['mb_sex'] == 'F') echo 'checked="checked"'; ?>>
<label for="mb_sex_f">여</label>
</td>
</tr>
Ⅱ. 그누보드 5.2
1. 그누보드5.2 / skin / member / basic / register_form.skin.php 추가
<tr>
<th scope="row"><label for="reg_mb_sex">성별</label></th>
<td>
<?php if ($member['mb_sex']) { // 본인이 성별 변경 금지 ?>
<input type="hidden" name="mb_sex" value="<?php echo $member['mb_sex']; ?>">
<?php if ($member['mb_sex']=="M") { echo "남"; } else { echo "여"; } ?>
<?php } else { ?>
<input type="radio" name="mb_sex" value="M" <?php echo $member['mb_sex']=="M"?"checked":""; ?>> 남
<input type="radio" name="mb_sex" value="F" <?php echo $member['mb_sex']=="F"?"checked":"";?>> 여
<?php } ?>
</td>
</tr>
3. 그누보드5.2 / adm / member_form.php 추가
<tr>
<th scope="row">생년월일</th>
<td>
<input type="radio" name="mb_birth" value="<?php echo $mb['mb_birth']; ?>>
</td>
<th scope="row">성별</th>
<td>
<input type="radio" name="mb_sex" value="M" <?php echo $member['mb_sex']=="M"?"checked":""; ?>> 남
<input type="radio" name="mb_sex" value="F" <?php echo $member['mb_sex']=="F"?"checked":"";?>> 여
</td>
</tr>
그누보드4에서부터 성별 필드인 mb_sex 가 존재하므로 이것을 이용해서 회원가입시 성별을 받는 방법입니다.
회원가입할때 성별 / 츨생년도(생년월일)을 받고자 할때는
Ⅰ. 그누보드 5.3
1. 그누보드5.3 / skin / member / basic / register_form.skin.php 추가
<li style=" height:0px;">
<div style="width:50%; float:left; height:0px; line-height:35px;">
<label for="reg_mb_sex">성별<strong class="sound_only">필수</strong></label>
<?php
if($member['mb_sex']) { // 본인 성별 변경 금지
echo "<input type=\"hidden\" name=\"mb_sex\" value=\"{$member['mb_sex']}\">";
if ($member['mb_sex']=="M") { echo "남"; } else { echo "여"; }
} else {
?>
<input type="radio" id="reg_mb_sex" name="mb_sex" value="M" <?php echo $member['mb_sex']=="M"?"checked":""; ?>> 남
<input type="radio" id="reg_mb_sex" name="mb_sex" value="F" <?php echo $member['mb_sex']=="F"?"checked":""; ?>> 여
<?php
}
?>
</div>
<div style="width:50%; float:left; height:0px;">
<?php include_once(G5_PLUGIN_PATH.'/jquery-ui/datepicker.php'); ?>
<script>
$(function(){
var dates = $( "#reg_mb_birth" ).datepicker({
changeYear: true, // 년 변경가능
changeMonth: true,
yearRange: "c-99:c+0",
dateFormat: "yymmdd", // 년월일 표시방법 yy-mm-dd 또는 yymmdd
numberOfMonths: 1, // 한눈에 보이는 월달력수
onSelect: function( selectedDate ) {
var option = this.id == "reg_mb_birth" ? "minDate" : "maxDate",
instance = $( this ).data( "datepicker" ),
date = $.datepicker.parseDate(
instance.settings.dateFormat ||
$.datepicker._defaults.dateFormat,
selectedDate, instance.settings );
dates.not( this ).datepicker( "option", option, date );
}
});
});
</script>
<label for="reg_mb_birth" class="sound_only">생년월일</label>
<input type="text" name="mb_birth" value="<?php echo $member['mb_birth'] ?>" id="reg_mb_birth" required readonly class="frm_input full_input required" size="12" maxlength="15" placeholder="생년월일">
</div>
<div style="clear:both;"></div>
</li>
2-1. 그누보드5.3 / bbs / register_form_update.php
if (get_session('ss_check_mb_id') != $mb_id || get_session('ss_check_mb_nick') != $mb_nick || get_session('ss_check_mb_email') != $mb_email) {
set_session('ss_check_mb_id', '');
set_session('ss_check_mb_nick', '');
set_session('ss_check_mb_email', '');
alert('올바른 방법으로 이용해 주십시오.');
}
를 아래와 같이 변경
if (get_session('ss_check_mb_id') != $mb_id || get_session('ss_check_mb_email') != $mb_email) {
//if (get_session('ss_check_mb_id') != $mb_id || get_session('ss_check_mb_nick') != $mb_nick || get_session('ss_check_mb_email') != $mb_email) {
set_session('ss_check_mb_id', '');
//set_session('ss_check_mb_nick', '');
set_session('ss_check_mb_email', '');
alert('올바른 방법으로 이용해 주십시오.');
}
2-2. 그누보드5.3 / bbs / register_form_update.php
if ($config['cf_cert_use'] && $cert_type && $md5_cert_no) {
// 해시값이 같은 경우에만 본인확인 값을 저장한다.
if ($_SESSION['ss_cert_hash'] == md5($mb_name.$cert_type.$_SESSION['ss_cert_birth'].$md5_cert_no)) {
$sql_certify .= " , mb_hp = '{$mb_hp}' ";
$sql_certify .= " , mb_certify = '{$cert_type}' ";
$sql_certify .= " , mb_adult = '{$_SESSION['ss_cert_adult']}' ";
$sql_certify .= " , mb_birth = '{$_SESSION['ss_cert_birth']}' ";
$sql_certify .= " , mb_sex = '{$_SESSION['ss_cert_sex']}' ";
$sql_certify .= " , mb_dupinfo = '{$_SESSION['ss_cert_dupinfo']}' ";
if($w == 'u')
$sql_certify .= " , mb_name = '{$mb_name}' ";
} else {
$sql_certify .= " , mb_hp = '{$mb_hp}' ";
$sql_certify .= " , mb_certify = '' ";
$sql_certify .= " , mb_adult = 0 ";
$sql_certify .= " , mb_birth = '' ";
$sql_certify .= " , mb_sex = '' ";
}
} else {
if (get_session("ss_reg_mb_name") != $mb_name || get_session("ss_reg_mb_hp") != $mb_hp) {
$sql_certify .= " , mb_hp = '{$mb_hp}' ";
$sql_certify .= " , mb_certify = '' ";
$sql_certify .= " , mb_adult = 0 ";
$sql_certify .= " , mb_birth = '' ";
$sql_certify .= " , mb_sex = '' ";
}
}
를 아래와 같이 변경
if ($config['cf_cert_use'] && $cert_type && $md5_cert_no) {
// 해시값이 같은 경우에만 본인확인 값을 저장한다.
if ($_SESSION['ss_cert_hash'] == md5($mb_name.$cert_type.$_SESSION['ss_cert_birth'].$md5_cert_no)) {
$sql_certify .= " , mb_hp = '{$mb_hp}' ";
$sql_certify .= " , mb_certify = '{$cert_type}' ";
$sql_certify .= " , mb_adult = '{$_SESSION['ss_cert_adult']}' ";
$sql_certify .= " , mb_birth = '{$_SESSION['ss_cert_birth']}' ";
$sql_certify .= " , mb_sex = '{$_SESSION['ss_cert_sex']}' ";
$sql_certify .= " , mb_dupinfo = '{$_SESSION['ss_cert_dupinfo']}' ";
if($w == 'u')
$sql_certify .= " , mb_name = '{$mb_name}' ";
} else {
$sql_certify .= " , mb_hp = '{$mb_hp}' ";
$sql_certify .= " , mb_certify = '' ";
$sql_certify .= " , mb_adult = 0 ";
$sql_certify .= " , mb_birth = '{$mb_birth}' "; // 해피정닷컴 수정
$sql_certify .= " , mb_sex = '{$mb_sex}' "; // 해피정닷컴 수정
}
} else {
if (get_session("ss_reg_mb_name") != $mb_name || get_session("ss_reg_mb_hp") != $mb_hp) {
$sql_certify .= " , mb_hp = '{$mb_hp}' ";
$sql_certify .= " , mb_certify = '' ";
$sql_certify .= " , mb_adult = 0 ";
$sql_certify .= " , mb_birth = '{$mb_birth}' "; // 해피정닷컴 수정
$sql_certify .= " , mb_sex = '{$mb_sex}' "; // 해피정닷컴 수정
} else { // 해피정닷컴 추가
$sql_certify .= " , mb_birth = '{$mb_birth}' "; // 해피정닷컴 추가
$sql_certify .= " , mb_sex = '{$mb_sex}' "; // 해피정닷컴 추가
}
}
3. 그누보드5.3 / adm / member_form.php 추가
<tr>
<th scope="row">출생년도</th>
<td>
<?php // https://www.happyjung.com/lecture/2841 참고 ?>
<!--<script src='http://code.jquery.com/jquery-2.1.4.js' type='text/javascript'></script>-->
<script>
$(window).load(function(){
var dob = $('.age').data('age');
var xmlHttp;
function srvTime(){
if (window.XMLHttpRequest) {
xmlHttp = new XMLHttpRequest();
xmlHttp.open('HEAD',window.location.href.toString(),false);
xmlHttp.setRequestHeader("Content-Type", "text/html");
xmlHttp.send('');
return xmlHttp.getResponseHeader("Date");
}else if (window.ActiveXObject) {
xmlHttp = new ActiveXObject('Msxml2.XMLHTTP');
xmlHttp.open('HEAD',window.location.href.toString(),false);
xmlHttp.setRequestHeader("Content-Type", "text/html");
xmlHttp.send('');
return xmlHttp.getResponseHeader("Date");
}
}
var st = srvTime();
if(dob != ''){
var str=dob.split('-');
var today = new Date(st);
var toMonth = today.getMonth()+1;
var toDate = today.getDate();
var toYear = today.getFullYear();
var toAge = toYear - str[0];
if (toMonth > str[1]){
dayDiff = toAge;
} else if (str[1] > toMonth) {
dayDiff = toAge -1;
} else {
if (str[2] > toDate) {
dayDiff =toAge -1;
} else {
var dayDiff = toAge;
}
}
var age = parseInt(dayDiff);
$('.age').html('( ' + toYear + '년 현재 : ' + age + '세 )');
}
});
</script>
<input type="text" name="mb_birth" value="<?php echo $mb['mb_birth']; ?>" class="frm_input" size="15">
<span data-age="<?php echo $mb['mb_birth']; ?>-00-00" class="age"></span>
</td>
<th scope="row">성별</th>
<td>
<input type="radio" id="reg_mb_sex" name="mb_sex" value="M" <?php if($mb['mb_sex'] == 'M') echo 'checked="checked"'; ?>>
<label for="mb_sex_m">남</label>
<input type="radio" id="reg_mb_sex" name="mb_sex" value="F" <?php if($mb['mb_sex'] == 'F') echo 'checked="checked"'; ?>>
<label for="mb_sex_f">여</label>
</td>
</tr>
Ⅱ. 그누보드 5.2
1. 그누보드5.2 / skin / member / basic / register_form.skin.php 추가
<tr>
<th scope="row"><label for="reg_mb_sex">성별</label></th>
<td>
<?php if ($member['mb_sex']) { // 본인이 성별 변경 금지 ?>
<input type="hidden" name="mb_sex" value="<?php echo $member['mb_sex']; ?>">
<?php if ($member['mb_sex']=="M") { echo "남"; } else { echo "여"; } ?>
<?php } else { ?>
<input type="radio" name="mb_sex" value="M" <?php echo $member['mb_sex']=="M"?"checked":""; ?>> 남
<input type="radio" name="mb_sex" value="F" <?php echo $member['mb_sex']=="F"?"checked":"";?>> 여
<?php } ?>
</td>
</tr>
3. 그누보드5.2 / adm / member_form.php 추가
<tr>
<th scope="row">생년월일</th>
<td>
<input type="radio" name="mb_birth" value="<?php echo $mb['mb_birth']; ?>>
</td>
<th scope="row">성별</th>
<td>
<input type="radio" name="mb_sex" value="M" <?php echo $member['mb_sex']=="M"?"checked":""; ?>> 남
<input type="radio" name="mb_sex" value="F" <?php echo $member['mb_sex']=="F"?"checked":"";?>> 여
</td>
</tr>
댓글목록
등록된 댓글이 없습니다.