<?
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 {
        $url = $g4[url];
    }
} else {
    $url = $_SERVER['HTTP_REFERER'];
}

if($icd) {
	$errsubj	= "<div style='color:#202020;'><img src='$member_skin_path/img/icon_feel_mark.gif' align='absmiddle'> <b>로그인 오류</b></div>";
	$errmsg		= "<div style='color:#9D9D9D; font-size:11px; line-height:140%;'>입력한 아이디 또는 비밀번호가 일치하지 않습니다. 비밀번호는 대/소문자를 구분하시기 바랍니다.</div><div style='color:#616161;'>로그인 $zm_config[loginfailcount]회 실패면 $zm_config[loginbanterm]시간 후에 다시 로그인 할 수 있습니다.";
	if($failtimes) $errmsg .= "<br>로그인 실패 횟수 : <font color='#F55451'>$failtimes 회</font>";
	$errmsg		.= "</div>";
}
?>

<script type="text/javascript" src="<?=$g4[path]?>/js/capslock.js"></script>
<style type="text/css">
#zmb_login_body		{ text-align:center; padding:20px; background:#fff; }
#zmb_login_body .login_box	{ border:2px solid #E5E5E5; background:#FDFDFD; width:100%; margin:auto; }
#zmb_login_body .sbj	{ font-size:14px; color:#414141; display:inline-block; width:70px; }
#zmb_login_body .mbid	{ font-size:20px; color:#2773B4; }
#confirm_mb_password	{ border:2px solid #E3E3E3; padding:2px; }
.ed			{ width:150px; height:24px; border:1px solid #989898; border-radius:3px; font-size:12px; }
</style>

<?=zm_topmenu("zm.basic")?>

<section id="zmb_login_body">
<div><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='<?=$url?>'>
<div class="login_box">
	<div style="margin:10px; padding:5px 20px; text-align:center;">
<?	if($icd) : ?>
		<div style="text-align:left; border:1px solid #E5E5E5; background:#FEFEFE; padding:10px;"><?=$errsubj?><?=$errmsg?>
		</div>
<?	endif; ?>
		<div style="margin:10px;">
		<div style="height:40px;">
			<span class="sbj"><b>아이디</b></span>
			<span class="mbid"><INPUT type=text class=ed maxLength=20 name=mb_id value="<?=$icd?>" itemname="아이디" required minlength="2"></span>
		</div>
		<div>
		<span class="sbj"><b>비밀번호</b></span>
		<span><INPUT type=password class=ed maxLength=20 name=mb_password id="login_mb_password" itemname="패스워드" required onkeypress="check_capslock(event, 'login_mb_password');"></span>
		</div>
		</div>
		<hr size="1" color="#ECECEC" align="center" width="100%">
		<div style="text-align:center;">
		<span><INPUT type=checkbox name=auto_login checked></span>
		<span style="">로그인 상태 유지</span>
		</div>
		<div style="margin:10px;">
			<INPUT type=image src="<?=$member_skin_path?>/img/btn_confirm.gif" border=0>
		</div>
		<hr size="1" color="#ECECEC" align="center" width="100%">
		<div style="text-align:left; margin:5px;">
			아직 회원이 아니십니까?&nbsp;&nbsp;<a href="./register.php"><img width="72" height="20" src="<?=$member_skin_path?>/img/btn_register.gif" border=0 align="absmiddle"></a>
		</div>
	</div>
</div> <!-- end login_box -->
</form>
</section>
<?=zm_bottom("zm.basic")?>

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

function flogin_submit(f)
{
    <?
    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>
