Fix: revised php code to maestro login

This commit is contained in:
2018-07-12 07:30:26 +09:00
parent 070b870044
commit 7aa212ee47
5 changed files with 18 additions and 25 deletions
+14 -22
View File
@@ -16,31 +16,25 @@ 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);
sendRequestServer( //url, sendParams, onSuccess, onFail, isDebugMode);
"./../server/maestro/login.php",
"maestro_name=" + name + "&password=" + password,
// if(replyJSON !== null)
// console.log(replyJSON);
(jsonData) => {
maestroID = jsonData["maestroID"];
sessionStorage.setItem("maestroID", maestroID);
location.href = './../maestro/main_menu.html';
},
// if(replyJSON["MaestroID"] !== undefined)
// console.log(replyJSON["MaestroID"]);
if(replyJSON !== null && replyJSON["MaestroID"] !== undefined && replyJSON["MaestroID"] !== null) {
maestroID = replyJSON["MaestroID"];
sessionStorage.setItem("maestroID", maestroID);
location.href = './../maestro/main_menu.html';
} else {
$("#error_message").val(replyJSON["ERROR"]);
(errorMessage) => {
if($("#error_message").length) {
$("#error_message").text(errorMessage);
}
}
}
);
}
</script>
@@ -64,7 +58,6 @@ function login() {
</div>
<div class="register">
<div class="col alignCenter" style="float: center;">
@@ -83,6 +76,5 @@ function login() {
</li>
</ol>
</div>
</div>