<?
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; font:normal 13px Dotum;'>로그인 $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	{ width:100%; margin:auto; }
#zmb_login_body .mbid	{ font-size:20px; color:#2773B4; }
.ed			{ width:250px; height:24px; border:1px solid #989898; border-radius:3px; font-size:16px; padding:10px 15px 10px 40px; margin:10px 0 5px 10px; letter-spacing: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; }
input.bttn_login	{ width:200px; border:1px solid #828282; border-radius:2px; background:#F3F3F3; padding:15px 25px 15px 25px; font:bold 16px '나눔고딕'; color:#494949; }
.msg		{ color:#BBBBBB; }
.etc_link a	{ color:#30C0FF; }
</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">
<?	if($icd) : ?>
		<div style="text-align:left; border:1px solid #E5E5E5; background:#FEFEFE; padding:10px;"><?=$errsubj?><?=$errmsg?>
		</div>
<?	endif; ?>
		<div class="mbid">
			<INPUT type=text class=ed maxLength=20 name=mb_id id=mb_id value="<?=$icd?>" itemname="아이디" minlength="2">
		</div>
		<div>
			<INPUT type=password class=ed maxLength=20 name=mb_password id="mb_password" itemname="비밀번호" onkeypress="check_capslock(event, 'login_mb_password');">
		</div>
		<hr size="1" color="#ECECEC" align="center" width="100%">
		<div style="margin:10px;">
			<INPUT type=submit value="로그인" class="bttn_login">
		</div>
		<div style="text-align:center;">
		<span><INPUT type=checkbox name=auto_login checked></span>
		<span class="msg">로그인 상태 유지</span>
		</div>
		<hr size="1" color="#ECECEC" align="center" width="100%">
		<div class="etc_link">
			<a href="./register.php">회원가입</a> ·
			<a href="./zm.userinfo.php?pcd=idfind">아이디 찾기</a> ·
			<a href="./zm.userinfo.php?pcd=pwfind">비밀번호 찾기</a>
		</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(!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>
