Files
chocomae/src/web/module/maestro_section_login.html
T
2018-06-26 23:51:39 +09:00

88 lines
1.9 KiB
HTML

<style>
.login {
background-color: #ff0000;
padding: 20px;
}
.register {
background-color: #0000ff;
padding: 20px;
}
</style>
<script>
function login() {
let name = $("#maestro_name").val();
let password = $("#password").val();
let xhr = new XMLHttpRequest(); //new로 생성.
xhr.open('POST', './../server/maestro/login.php', true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.send("maestro_name=" + name + "&password=" + password);
xhr.onload = function() {
if(xhr.readyState === 4 && xhr.status === 200) {
let replyJSON = JSON.parse(xhr.responseText);
// console.log(replyJSON);
// if(replyJSON !== null)
// console.log(replyJSON);
// if(replyJSON["MaestroID"] !== undefined)
// console.log(replyJSON["MaestroID"]);
if(replyJSON !== null && replyJSON["MaestroID"] !== undefined && replyJSON["MaestroID"] !== null) {
sessionStorage.setItem("maestroID", replyJSON["MaestroID"]);
location.href = './../maestro/main_menu.html';
} else {
$("#error_message").val(replyJSON["ERROR"]);
}
}
}
}
</script>
<div class="container">
<div class="login">
<div>
마에스트로 아이디
<input type="text" id="maestro_name" name="maestro_name"><br/>
암호
<input type="password" id="password" name="password"><br/>
</div>
<div class="col alignCenter">
<a id="login" class="btn btn-sea width400" onClick="login()">로그인</a>
</div>
<textarea id="error_message">
</textarea>
</div>
<div class="register">
<div class="col alignCenter" style="float: center;">
<a href="./../maestro/register.html" id="register" class="btn btn-sea width400">마에스트로<br/>가입</a>
</div>
<ol>
<li>
1만원 : 플레이어 20명
</li>
<li>
2만원 : 플레이어 50명
</li>
<li>
3만원 : 플레이어 100명
</li>
</ol>
</div>
</div>