<?php
	require("../__common__/__define_mobile.php");
	if ($_POST) {
		post_done_proc();
	} else {
		form_proc();
	}
	exit();
function form_proc() {
?>
<!DOCTYPE html>
<html lang="ja">
<head>
<?php
	mobile_common_head('myHome ログイン');
?>
</head>
<body>
<div data-role="page" data-url="<?= $_SERVER['REQUEST_URI'] ?>" id="sample_button">
	<div data-role="header">
		<a href="../index" data-icon="home" rel="external">Home</a>
		<h1>ログイン</h1>
	</div>
	<div data-role="content">
		<div data-role="fieldcontain">
			<form method="post" action="">
			<label for="account">アカウント：</label><input type="text" data-inline="true" id="account" name="account" value="">
			<label for="password">パスワード：</label><input type="password" data-inline="true" id="password" name="password" value="">
			<div data-inline="true">
				<input type="submit" value="ログイン" data-theme="b" data-inline="true">
				<input type="reset" value="クリア" data-inline="true">
			</div>
			</form>
		<?= $errmsg ?>
		</div>
	</div>
</div>
</body>
</html>
<?php
}
function post_done_proc() {
	if (isset($_POST['account'])) {
		$account = form_str_adjust($_POST['account']);
	}
	if (isset($_POST['password'])) {
		$password = $_POST['password'];
	}
	if (($errmsg=mobile_login($account, $password)) == '') {
		redirect('../index');
	}
?>
<!DOCTYPE html>
<html lang="ja">
<head>
<?php
	mobile_common_head('myHome ログイン');
?>
</head>
<body>
<div data-role="page" data-url="<?= $_SERVER['REQUEST_URI'] ?>" id="top">
	<div data-role="header">
		<a href="../login" data-icon="back" rel="external">戻る</a>
		<h1>ログイン エラー</h1>
	</div>
	<div data-role="content">
		<?= $errmsg ?>
	</div>
</div>
</body>
</html>
<?php
}
?>
