Add: maestro login php

This commit is contained in:
2018-06-26 18:07:15 +09:00
parent f3b51ae5a2
commit 77afebbb3a
7 changed files with 131 additions and 17 deletions
+40 -12
View File
@@ -10,30 +10,58 @@
}
</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>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
<div>5</div>
<div>
<form action="/action_page.php" method="get" id="maestro_login">
마에스트로 아이디
<input type="text" name="maestro_id"><br/>
<input type="text" id="maestro_name" name="maestro_name"><br/>
암호
<input type="password" name="maestro_id"><br/>
</form>
<input type="password" id="password" name="password"><br/>
</div>
<div class="col alignCenter">
<a href="./../maestro/main_menu.html" id="faq" class="btn btn-sea width400">로그인</a>
<a id="login" class="btn btn-sea width400" onClick="login()">로그인</a>
</div>
<textarea id="error_message">
</textarea>
</div>
@@ -41,7 +69,7 @@
<div class="register">
<div class="col alignCenter" style="float: center;">
<a href="./../maestro/register.html" id="faq" class="btn btn-sea width400">마에스트로<br/>가입</a>
<a href="./../maestro/register.html" id="register" class="btn btn-sea width400">마에스트로<br/>가입</a>
</div>
<ol>