<?
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;
}
?>

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


<form name="fhead" method="post" onsubmit="return fhead_submit(this);" autocomplete="off" style="margin:0px;">
<input type="hidden" name="url" value="<?=$outlogin_url?>">
				
<div class="cr_login">						
	<ul>
		<li><input name="mb_id" type="text" size="12" maxlength="20" required itemname="아이디" value="아이디" onMouseOver="chkReset(this.form);" onFocus="chkReset(this.form);"></li>
		<li>
			<div id="pw1">
			<input type="text" size="12" maxlength="20" required itemname="패스워드" value='패스워드' onMouseOver='chkReset(this.form);' onfocus='chkReset(this.form);'>
			</div>

			<div id="pw2" style="display:none;">
			<input name="mb_password" id="outlogin_mb_password" type="password" size="12" maxlength="20" itemname="패스워드" onMouseOver="chkReset(this.form);" onfocus="chkReset(this.form);" onKeyPress="check_capslock(event, 'outlogin_mb_password');">
			</div>							
		</li>
		<li class="cl_text"><b><a href="<?=$g4[bbs_path]?>/register.php">회원가입</a></b> | <a href="javascript:win_password_lost();">아이디/패스워드</a></li>
		<span class="cl_login"><button type="submit">로그인</button></span>
	</ul>
</div>

</form>

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