<?
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) {
	$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; margin:50px; }
#zmb_login_body .login_box	{ border:2px solid #E5E5E5; background:#FDFDFD; width:640px; margin:auto; }
#zmb_login_body .sbj	{ font-size:15px; color:#414141; font-family:돋움; }
#zmb_login_body .mbid	{ font-size:20px; color:#2773B4; font-family:돋움; }
#confirm_mb_password	{ border:2px solid #E3E3E3; padding:2px; }
</style>

<?=zm_topmenu("zm.basic")?>
<div 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='<?=$login_url?>'>
<div class="login_box">
	<div style="margin:20px; 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:20px;">
		<span class="sbj"><b>아이디</b></span>
		<span class="mbid"><INPUT type=text class=ed maxLength=20 size=15 name=mb_id value="<?=$icd?>" itemname="아이디" required minlength="2"></span>
		<span class="sbj" style="margin-left:30px;"><b>비밀번호</b></span>
		<span><INPUT type=password class=ed maxLength=20 size=15 name=mb_password id="login_mb_password" itemname="패스워드" required onkeypress="check_capslock(event, 'login_mb_password');"></span>
		</div>
		<hr size="1" color="#ECECEC" align="center" width="550">
		<div style="text-align:center;">
		<span><INPUT onclick="if (this.checked) { if (confirm('공공장소에서는 개인정보가 유출 될 수 있으니 PC에서만 사용하시기 바랍니다. ')) { this.checked = true; } else { this.checked = false;} }" type=checkbox name=auto_login></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="550">
		<div style="text-align:left; margin:5px;">
			<!-- <td height="26" colspan="2"><img src="<?=$member_skin_path?>/img/icon.gif" width="3" height="3"> 아이디/패스워드를 잊으셨습니까?&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:;" onclick="win_password_forget('./password_forget.php');"><img src="<?=$member_skin_path?>/img/btn_password_forget.gif" width="108" height="20" border=0 align="absmiddle"></td> -->
			아직 회원이 아니십니까?&nbsp;&nbsp;&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 style="text-align:left; margin:5px;">
            아이디/패스워드를 잊으셨습니까?&nbsp;&nbsp;&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>
</div> <!-- end login_box -->
</form>
</div>

<?=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>
