<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가

if ($g4['https_url']) {
    $login_url = $_GET['url'];
    if ($login_url) {
        if (preg_match("/^\.\.\//", $url)) {
            $login_url = urlencode($g4[url]."/".preg_replace("/^\.\.\//", "", $login_url));
        } else {
            $purl = parse_url($g4[url]);
            if ($purl[path]) {
                $path = urlencode($purl[path]);
                $urlencode = preg_replace("/".$path."/", "", $urlencode);
            }
            $login_url = $g4[url].$urlencode;
        }
    } else {
        $login_url = $g4[url];
    }
} else {
    $login_url = $_SERVER['HTTP_REFERER'];
}

if($icd) {
	$errmsg		= "<div>아이디 또는 비밀번호가 일치하지 않습니다.</div><div>로그인 <b>$zm_config[loginfailcount]회</b> 실패면 $zm_config[loginbanterm]시간 후에 다시 로그인 할 수 있습니다.";
	if($failtimes) $errmsg .= "<br><span style='color:#BE8D00;'>로그인 실패 횟수 : <b>$failtimes 회</b></span>";
	$errmsg		.= "</div>";
}
?>

<script type="text/javascript" src="<?=$g4[path]?>/js/capslock.js"></script>
<style type="text/css">
/* 페이지 최상단 */
#special_link		{ clear:both; text-align:center; border-bottom:1px solid #EBEBEB; background-color:#FBFBFB; height:24px; padding-top:5px; }

#zmb_login_body		{ text-align:center; margin:50px; }
#zmb_login_body .login_box	{ width:300px; margin:auto; padding:30px 40px 20px 40px; }
#zmb_login_body .loginin	{ text-align:left; margin:5px 0 5px 0; }
#zmb_login_body input.ed	{ width:300px; border:1px solid #D3D3D3; border-radius:4px; padding:12px 15px 10px 45px; color:#7A7A7A; font-weight:bold; }
#zmb_login_body .autologin	{ color:#727272; font:normal 11px 나눔고딕; }

#zmb_login_body .errmsg		{ font:normal 11px Dotum; color:#E55349; line-height:160%; text-align:left; margin:10px 0 10px 0; }
#zmb_login_body .btnlogin	{ border:1px solid #70A7AE; border-radius:3px; width:330px; padding:12px 0 8px 0; text-align:center; background:#70A7AE; color:#ffffff; font:bold 16px Dotum; cursor:pointer; }
#confirm_mb_password	{ border:2px solid #E3E3E3; padding:2px; }

input#mb_id	{ background:url("<?=$member_skin_path?>/img/icon_id.gif") no-repeat; background-position:5px; }
input#mb_password	{ background:url("<?=$member_skin_path?>/img/icon_pswd.gif") no-repeat;  background-position:5px; }
</style>

<div id="special_link">
	<a href="<?=ZM_BUILDER_URL?>"><img src="<?=$member_skin_path?>/img/icon_home.gif"></a>
</div> <? //-- end special_link -- ?>

<div id="zmb_login_body">
<div style="text-align:left; width:320px; margin:auto;"><img src="<?=$member_skin_path?>/img/title_login.gif"></div>

<form name="flogin" method="post" onsubmit="return flogin_submit(this);" autocomplete="off">
<input type="hidden" name="url" value='<?=$login_url?>'>
<div class="login_box">
	<div class="loginin"><INPUT type=text class=ed maxLength=20 id="mb_id" name=mb_id value="<?=($icd)?$icd:""?>" itemname="아이디" minlength="2"></div>
	<div class="loginin pswd_real"><INPUT type="password" class=ed maxLength=20 id="mb_password" name=mb_password value="" itemname="비밀번호" onkeypress="check_capslock(event, 'login_mb_password');"></div>
	<div class="loginin autologin"><INPUT onclick="if (this.checked) { if (confirm('공공장소에서는 개인정보가 유출 될 수 있으니 PC에서만 사용하시기 바랍니다. ')) { this.checked = true; } else { this.checked = false;} }" type=checkbox name=auto_login> 로그인 상태 유지</div>
		
<?	if($icd) : ?>
		<div class="errmsg"><?=$errmsg?></div>
<?	endif; ?>

	<div style="margin:20px 0 40px 0;">
		<INPUT type="submit" value="로그인" class="btnlogin">
	</div>
	
	<div style="border-top:1px solid #ECECEC; width:330px;"></div>
	<div style="text-align:left; margin:20px 0 20px 0;">
		<a href="./register.php"><img width="72" height="20" src="<?=$member_skin_path?>/img/btn_register.gif" border=0 align="absmiddle"></a>
		&nbsp;&nbsp;
        <a href="<?=$g4[path]?>/bbs/zm.userinfo.php?pcd=idfind"><img src="<?=$member_skin_path?>/img/btn_password_forget.gif" width="108" height="20" border=0 align="absmiddle"></a>
	</div>
	<div style="border-top:1px solid #ECECEC; width:330px;"></div>
	<div style="padding:20px; color:#CBCBCB; font:normal 11px Gulim;">Copyright(c) All right reserved.</div>
</div> <!-- end login_box -->
</form>
</div>


<script type='text/javascript'>
document.flogin.mb_id.focus();

function flogin_submit(f)
{
	if(!f.mb_id.value) {
		alert("아이디 입력이 없습니다.");
		f.mb_id.focus();
		return false;
	}
	if(!f.mb_password.value){
		alert("비밀번호 입력이 없습니다.");
		f.mb_password.focus();
		return false;
	}

    <?
    if ($g4[https_url])
        echo "f.action = '$g4[https_url]/$g4[bbs]/login_check.php';";
    else
        echo "f.action = '$g4[bbs_path]/login_check.php';";
    ?>

    return true;
}
</script>
