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

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

<link rel="stylesheet" href="<?=$outlogin_skin_path?>/style.css" type="text/css">
<script type="text/javascript" src="<?=$g4[path]?>/js/capslock.js"></script>
<script type="text/javascript">
// 엠파스 로긴 참고
var bReset = true;
function chkReset(f)
{
    if (bReset) { if ( f.mb_id.value == '아이디' ) f.mb_id.value = ''; bReset = false; }
    document.getElementById("pw1").style.display = "none";
    document.getElementById("pw2").style.display = "";
}
</script>
<div id="zmb_outlogin_body">
<!-- 로그인 전 외부로그인 시작 -->
<form name="fhead" method="post" onsubmit="return fhead_submit(this);" autocomplete="off">
<input type="hidden" name="url" value="<?=$outlogin_url?>">
<div class="zmb_login_always">
	<input type="checkbox" name="auto_login" id="auto_login" value="1" onclick="if(this.checked) { zm_alert('공공장소에서는 개인정보가 유출될 수 있으니 개인용 컴퓨터에서만 사용해 주세요.') }"><label for="auto_login">로그인 상태 유지</label>
</div>
	<div id="zmb_login_info_box_left">
	<div class="zmb_login_input_box"><input name="mb_id" type="text" class="zmb_login_input" size="12" maxlength="20" itemname="아이디" value='아이디' onFocus='chkReset(this.form);'></div>
	<div class="line"></div>
	<div id="pw1" class="zmb_login_input_box"><input type="text" class="zmb_login_input" size="12" maxlength="20" itemname="비밀번호" value='비밀번호' onfocus='chkReset(this.form);'></div>
	<div id="pw2" class="zmb_login_input_box" style="display:none;"><input name="mb_password" id="outlogin_mb_password" type="password" class="zmb_login_input" size="12" maxlength="20" itemname="비밀번호" onMouseOver='chkReset(this.form);' onfocus='chkReset(this.form);' onKeyPress="check_capslock(event, 'outlogin_mb_password');"></div>
</div>
<div id="zmb_login_info_box_right">
	<input type="submit" value="로그인">
</div>

<div id="zmb_member_join">
	<span class="zmb_join_box">
		<a href="<?=$g4[bbs_path]?>/register.php"><b>회원가입</b></a>
	</span>
	<span class="zmb_join_box">
		<a href="<?=$g4[bbs_path]?>/zm.userinfo.php?pcd=idfind&c=0">아이디</a><a href="<?=$g4[bbs_path]?>/zm.userinfo.php?pcd=pwfind&c=1">·비밀번호 찾기</a>
	</span>
</div>
</form>
</div>

<script type="text/javascript">
function fhead_submit(f)
{
    if (!f.mb_id.value) {
        alert("회원아이디를 입력하십시오.");
        f.mb_id.focus();
        return false;
    }

    if (document.getElementById('pw2').style.display!='none' && !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>
<!-- 로그인 전 외부로그인 끝 -->