<?
include_once("./inc.php");
include_once("./config.php");
include_once("./db.php");
include_once("./fun.php");
?>
<!doctype html>
<html lang="zh-Hant-TW">
<head>
	<? include_once("includeBtn/btn_head.php") ?>	
</head>
<?
if ($_REQUEST["action"]=="login") {

	$account	= data_post_fixsql("Account",'');
	$password	= data_post_fixsql("password",'');
	
	$password       = md5($password);
	$ip = $_SERVER['REMOTE_ADDR'];
	
	if(!isset($_SESSION["err_nums"])) $_SESSION["err_nums"] = 0;
	
	if ($_SESSION["err_nums"]>=5){

        $updata_data = array(
            'ad_islock' => '1',
            'ad_lastlogin' => date('Y-m-d H:i:s')
        );
		update_db("ad_admin",$updata_data,array('ad_account'=>$account));

		alert("錯誤次數過多，帳號鎖定");
		exit();
	}

	echo $account;
	exit;

}
?>
<body>
	<div class="blok">
		<div class="container indexTexContent">	
			<div class="col-md-8 col-md-offset-2 ">
				<img class="img-responsive indexLogo" src="<?=base_url('/root/images/tw_img/logo/index_logo.jpg')?>" alt="logo" />
                <div class="in_text">
				<p class="title"></p>
                <p class="subtitle"><?=TITLE_NAME?></p>
                <!--<p class="en_subtitle">TAOYUAN CITY FARMERS' ASSOCIATION</p>-->
                <hr>
				</div>
				<div class="clearfix"></div>
		
				<div class="loginBtn">
					<a href="#" data-toggle="modal" data-target="#smallModal1">登入</a>
				</div>		
			</div>
		</div>		
	</div>
	<? include_once("includeBtn/btn_login.php") ?>	
	<? include_once("includeBtn/btn_js.php") ?>	
</body>
<script>
	$("#Sendlogin").click(function(e){
		let act = $("#act").val();
		let pwd = $("#pwd").val();
		if(act==""){alert('請輸入帳號');return false}
		if(pwd==""){alert('請輸入密碼');return false}
		$("#login_form").submit();
	});
	function enterKeyDown(){
		if(event.keyCode==13){
			$("#Sendlogin").click();
		}
	}
</script>
<? if(!empty($errormsg)){ ?>
<script>
	alert('<?=$errormsg?>'); 
</script>
<? } ?>
</html>

